Closed
Milestone
Description
MPL is such a great tool I tend to use it in many projects. Although amazing in so many ways, one area of improvement is the support for compression for TIFF images. Compression works when saving to other formats but it does not work with TIFF format. Note that TIFF is the format most scientific journal prefer for figures. MPL is great at so many things, I think embedding an LZW compression algorithm would be great. Currently we have to resort to PIL or PILLOW and do this:
- create the image with MPL
- save to tiff, uncompressed -- easily 500MB
- load PIL library
- load the 500MB image with PIL
- re-save the image in PIL using the flag compression=LZW.
If we could spare steps 3-5 it would be great I think...
Thanks!!!
Reacted by georgexsh, Hui Wang and Markus Völk
Metadata
Metadata
Assignees
Labels
No labels
Activity
jenshnielsen commentedon Apr 24, 2017
Matplotilib is actually using PIL internally to save into TIFF. Look at the end of https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_agg.py#L627
It should be relatively simple to add an optional compression flag to the print_tif method there. Compare with the additional jpeg options just above which also uses PIL and have more options.
If you feel like making the changes your self a pull request is very welcome.
renato-umeton commentedon Apr 24, 2017
Thanks, Jens. My implementation would look like this -- may I use the TiffImagePlugin as stated?
Thanks!