Skip navigation
TTanna
Currently Being Moderated

Getting channel information

Jun 21, 2012 12:10 AM

Tags: #channels

Hi,

I'm trying to extract the channel information from a .psd file in binary mode. I'm able to extract the number of channels and their names, but not their types (I mean if it's a spot color channel or a mask). The documentation I've found is from 1997 and some things are not the same with the newest versions. Do you know how to do it?

 

Thank you very much,

Anna

 
Replies
  • Currently Being Moderated
    Jun 21, 2012 1:09 AM   in reply to TTanna

    Get the current Photoshop SDK and read the documentation for the PSD format.

     

    The channel type and other information is in an image resource block, but hasn't really changed in many years.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2012 9:43 AM   in reply to TTanna

    The current SDK is much newer than 1997.

    Again, you should get the current SDK for CS5 or CS6.

     

    There is a specific resource for channel information, that describes the channel type and options.

     
    |
    Mark as:
  • Noel Carboni
    23,469 posts
    Dec 23, 2006
    Currently Being Moderated
    Jun 21, 2012 10:56 AM   in reply to Chris Cox

    Can you be a bit more specific, Chris? 

     

    Unless I'm being a real bonehead today and missing something obvious, the Photoshop CS6 SDK carries no documentation on the PSD format nor an image resource block.  I found a few references to same in PIUtiliites.h, that's all.

     

    On the other hand, Google turns this up in an eyeblink: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2012 11:02 AM   in reply to Noel Carboni

    The PSD documentation should be in the SDK now, we put it back in CS5 after having it as a separate download for years.

     

    And yes, that HTML version appears to be the CS5 documentation.

     
    |
    Mark as:
  • Noel Carboni
    23,469 posts
    Dec 23, 2006
    Currently Being Moderated
    Jun 21, 2012 11:28 AM   in reply to Chris Cox

    Please double check.  I think you may have remembered it backwards.

     

    I searched the SDKs thoroughly.  There is no description of the PSD format or an "image resource block" in the Photoshop CS5 or CS6 SDKs. 

     

    There IS however, some information in the CS3 and CS4 SDKs (I didn't look back farther than that).  Example:  documentation\html\imageresourcessection.html

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 7:29 AM   in reply to Chris Cox

    This information was stored in resource block 1007 (0x03ef) - its structure matched DisplayInfo described in Appendix A (Photoshop API Guide). This resource block is no longer written by CS6 and block 1077 is used instead. Block 1077 is using different internal format than 1007 - where could be description of new format found?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 7:39 AM   in reply to Milan Brunclik

    I have the same issue.

     

    The description of the new format can be found in "Photoshop API Guide.pdf" which is part of the Photoshop SDK.

     

    struct DisplayInfo

    {

        int16 colorSpace;

        int16 color[4];

        int16 opacity; // 0..100

        char kind; // selected = 0, protected = 1

        char padding; // should be zero

    };

     

    Sadly the information about alpha or spot channel is not in there.

    Since Photoshop can still determine the extra channel type, this information must be stored someplace else.

     

    There has to be somebody at Adobe, who can give us this information.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 9:36 AM   in reply to slone84

    I was wrong about the information not being in image resource block 1077.

    It's just not documented (in the documents I looked at), how to read it correctly.

     

    With a lot of help from others I figured it out.

    The data is almost the same as in block 1007, but not exactly.

     

    The differences are:

    1) Additional 4 bytes a the beginning, that contain the version number (which seems to be 1).

    2) The array of DisplayInfo structures looses the 1 byte padding at the end of every structure. (so now it's 13 bytes per structure instead of 14)

     

    struct DisplayInfo

    {

        int16 colorSpace;

        int16 color[4];

        int16 opacity; // 0..100

        char mode; // alpha = 0, inverted alpha = 1, spot =2

    };

     

    So the alpha information is in the last byte of the DisplayInfo structures.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points