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