Skip to content

Can't open CMYK tiff image with spot channels #2821

Description

@genequ

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

Thanks for taking care of this!

Activity

  1. wiredfool commented on Nov 1, 2017

    @wiredfool
    Member

    We're currently not able to open files with more than 4 channels.

  2. homm commented on Dec 10, 2017

    @homm
    Member

    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?

  3. wiredfool commented on Dec 10, 2017

    @wiredfool
    Member

    @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.

  4. homm commented on Dec 11, 2017

    @homm
    Member

    @wiredfool Interesting idea. How we can provide access to additional channels? Via image.info?

  5. genequ commented on Dec 18, 2017

    @genequ
    Author

    @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

  6. homm commented on Jan 7, 2018

    @homm
    Member

    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:

    EXTRASAMPLE_UNSPECIFIED = 0;
    EXTRASAMPLE_ASSOCALPHA = 1;
    EXTRASAMPLE_UNASSALPHA = 2;
    

    The sample file has the following value:

    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,).

  7. homm commented on Jan 7, 2018

    @homm
    Member

    @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?

  8. genequ commented on Jan 8, 2018

    @genequ
    Author

    @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.

  9. radarhere commented on Feb 27, 2021

    @radarhere
    Member

    #2938 was merged. Closing in favour of the tracking issue, #1888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions