9 Replies Latest reply on Oct 25, 2012 9:36 AM by slone84

    Getting channel information



      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,


        • 1. Re: Getting channel information
          Level 7

          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.

          • 2. Re: Getting channel information
            TTanna Level 1

            It's that documentation the one that I'm reading. As I said before, I've been able to find within the resource block the other channel information, but I can't find the type.

            • 3. Re: Getting channel information
              Level 7

              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.

              • 4. Re: Getting channel information
                Noel Carboni Level 8

                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/



                • 5. Re: Getting channel information
                  Level 7

                  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.

                  • 6. Re: Getting channel information
                    Noel Carboni Level 8

                    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



                    • 7. Re: Getting channel information
                      Milan Brunclik

                      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?

                      • 8. Re: Getting channel information

                        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.

                        • 9. Re: Getting channel information
                          slone84 Level 1

                          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.