You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't open CMYK tiff image with spot channels #2821
The provided sample file has 5 channels, CMYK + PMS 200 C. When i am trying to open it using
Image.open(), it reports: IOError: cannot identify image file '/Users/gequ/Desktop/cmyk.tif' cmyk.tif.zip
I also have requests for such files from our users and the only solution I see without rewriting most parts of Pillow is on-the-fly conversion to RGBA.
@homm I wonder if we could figure out a way to spilt extra channels out as additional bands in the image structure, so that we'd have our usual optimized set of pixels, and spot channels like this would essentially be extra single band images.
@homm it is common a file with several spot channels in the prepress industry(mostly generated by Adobe's product). I do not know if it is a good idea to convert to RGBA. @wiredfool that sounds promising
Hi! I've created the fix #2938 which allows opening some TIFFs with ExtraSamples. The problem is that that fix also allows opening your sample TIFF while shouldn't. Some more explanation:
TIFF files contain ExtraSamples marker which tells how to interpret extra channels. According to the docs, it could have three values:
tag: ExtraSamples (338) - type: short (3) - value: (0,)
This means that additional channel in the file contains some service information. So I suppose that it is legal to open the file and discard that channel if we don't know what to do with it. On the other hand, macOS's Preview and Windows's 7 Photo viewer treats that channel as the alpha channel. But InfanView and Paint.NET don't.
It is more likely that the file should have ExtraSamples (1,).
@genequ Oh, I'm sorry, just noticed that you never claim that this is alpha channel. So, does discarding the extra channel is better than rejecting the entire image for you?
@homm, thanks a lot for your effect!
Do you mean the value (0) for ExtraSamples is invalid in the sample file? It is created by Adobe Photoshop anyway.
Discarding the spot channels does not actually solve my problem since those channels always contain real contents.
Activity
wiredfool commentedon Nov 1, 2017
We're currently not able to open files with more than 4 channels.
homm commentedon Dec 10, 2017
I also have requests for such files from our users and the only solution I see without rewriting most parts of Pillow is on-the-fly conversion to RGBA.
@genequ Will you be satisfied with such solution?
wiredfool commentedon Dec 10, 2017
@homm I wonder if we could figure out a way to spilt extra channels out as additional bands in the image structure, so that we'd have our usual optimized set of pixels, and spot channels like this would essentially be extra single band images.
homm commentedon Dec 11, 2017
@wiredfool Interesting idea. How we can provide access to additional channels? Via image.info?
genequ commentedon Dec 18, 2017
@homm it is common a file with several spot channels in the prepress industry(mostly generated by Adobe's product). I do not know if it is a good idea to convert to RGBA.
@wiredfool that sounds promising
homm commentedon Jan 7, 2018
Hi! I've created the fix #2938 which allows opening some TIFFs with ExtraSamples. The problem is that that fix also allows opening your sample TIFF while shouldn't. Some more explanation:
TIFF files contain
ExtraSamplesmarker which tells how to interpret extra channels. According to the docs, it could have three values:The sample file has the following value:
This means that additional channel in the file contains some service information. So I suppose that it is legal to open the file and discard that channel if we don't know what to do with it. On the other hand, macOS's Preview and Windows's 7 Photo viewer treats that channel as the alpha channel. But InfanView and Paint.NET don't.
It is more likely that the file should have ExtraSamples (1,).
homm commentedon Jan 7, 2018
@genequ Oh, I'm sorry, just noticed that you never claim that this is alpha channel. So, does discarding the extra channel is better than rejecting the entire image for you?
genequ commentedon Jan 8, 2018
@homm, thanks a lot for your effect!
Do you mean the value (0) for ExtraSamples is invalid in the sample file? It is created by Adobe Photoshop anyway.
Discarding the spot channels does not actually solve my problem since those channels always contain real contents.
radarhere commentedon Feb 27, 2021
#2938 was merged. Closing in favour of the tracking issue, #1888