Closed
Description
I load a CMYK image, which I know had no compression,
It is ok, for I can visualize it.
Then, I try to save it compressed, and get an IOError
If I enable debuging setting Image.DEBUG=1 I get some more info
The error occurs in
TIFFWriteScanline: ECI2002_ccitt.tif: Must set "PlanarConfiguration before writing data.
Traceback (most recent call last):
"PIL\Image.py", line 1464, in save
save_handler(self, fp, filename)
"PIL\TiffImagePlugin.py", line 1073, in _save
raise IOError("encoder error %d when writing image file" % s)
IOError: encoder error -2 when writing image file
Info from the file
- compression: raw
- photometric_interpretation: 5
- planar_configuration: 1
- fill_order: 1
- size: (3509, 4677)
format key: ('II', 5, 1, 1, (8, 8, 8, 8), ()) - raw mode: CMYK
- pil mode: CMYK
tiles: [('raw', (0, 0, 3509, 4677), 182, ('CMYK', 0, 1))]
Code I am executing
im=Image.open("ECI2002.tif")
im.show()
im.save("ECI2002_ccitt.tif",compression="tiff_ccitt")
Activity
wiredfool commentedon Nov 6, 2013
I don't think that tiff_ccitt will work with non b/w images. The CCITT compression modes (like group3 and 4) are black and white only.
On the other hand, it doesn't look like libtiff saving works with anything that requires BitsPerSample to be more than one element, and there's also a missing PlanarConfiguration tag.
wiredfool commentedon Nov 6, 2013
Check out this branch for a WIP fix: https://github.com/wiredfool/Pillow/tree/libtiff-save2
ignaciordc commentedon Nov 6, 2013
I´ll do that, thanks.
2013/11/6 wiredfool [email protected]
Merge pull request python-pillow#401 from radarhere/freetype