Photoshop image resource blocks

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Shiba

Photoshop image resource blocks

Post by Shiba »

I am attempting to write a set of subroutines which are capable of manipulating the proprietary Photoshop paths stored in the IRBs of images saved by Photoshop. The relevant IDs are between 0x07D0 and 0x0BB6, with selector values of 1 or 2 (closed subpath bezier knots). The minimal documentation I've been able to locate seems to indicate that these records contain 3 quadwords describing control and anchor points, which are further subdivided into two dwords describing the vertical and horizontal components. My documentation states that these dwords are fixed-point values with 8 bits before the binary point and 24 bits after the binary point. I see that ImageMagick can already handle this: the following command will output an SVG describing the 8BIM embedded path named PATH_NAME:

identify -format '%[8BIM:1999,2998:PATH_NAME]' some_image.jpg

The problem I'm having is that I can't locate the code which actually does this conversion and I don't understand the data format that the individual dwords are stored in. Initially I thought I might be able to just use gcc's _Decimal32, but that appears not to be the case. Can anyone describe how to understand / decode these values, or point me to the code in ImageMagick which does so?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Photoshop image resource blocks

Post by magick »

See Get8BIMProperty() in magick/property.c.
Shiba

Re: Photoshop image resource blocks

Post by Shiba »

Thank you very much. It looks like the relevant information is available in TracePSClippath() on line 1669, which is called near the end of Get8BIMProperty(). I also managed to find corroborating evidence from another project (psdparse) here:

http://telegraphics.com.au/svn/psdparse ... esources.c

Hopefully this post will be useful to anyone trying to do what I'm doing in the future. All praises to the ImageMagic developers!
Post Reply