brendonh / pyth

Python text markup and conversion
MIT License
89 stars 79 forks source link

Add xhtml inline png image support #35

Open kippr opened 8 years ago

kippr commented 8 years ago

Images are already present in the Document model when read from RTF. This change converts any PNG images found into img tags with inline base64 encoded data elements. Other images (for example WMF alternatives and jpegs) are ignored.

Previous behaviour was to write out the hex-encoded image string.

I needed this behaviour - hope it might be useful to others as well. Inline data images are widely supported now (http://caniuse.com/#feat=datauri) so I think this is a reasonable way to handle rtf to html conversion.

Thanks