dragon66 / icafe

Java library for reading, writing, converting and manipulating images and metadata
Eclipse Public License 1.0
203 stars 58 forks source link

Parsing private TIFF Tag 37724 - Adobe Photoshop Document Data Block" #13

Open dragon66 opened 9 years ago

dragon66 commented 9 years ago

This tag is Adobe private TIFF tag with a structure similar to Photoshop Image Resource Block with building block 8BIM.

dragon66 commented 9 years ago

The following information is available for this tag:

Adobe Photoshop specific image source data tag. This section has the layer and mask information found in a typical layered Photoshop file. Field: ImageSourceData Tag: 37724 (935C.H) Type: UNDEFINED Count: number of bytes for section The section starts with a character string of "Adobe Photoshop Document Data Block" including the null termination character. The remainder of the count, after subtracting the length of the above mentioned string, is a series of tagged data types in the following format:

4 bytes Signature ‘8BIM’
4 bytes Type various types (see below)
4 bytes Length length in bytes, variable for each type, padded to a 4 byte offset

The various types are mentioned here with further documentation in the Photoshop File Formats.pdf. The available types are:

‘Layr’ Layer Data
‘LMsk’ User Mask Same as Global layer mask info table
‘Patt’ Pattern
‘Anno’ Annotations
dragon66 commented 9 years ago

Information regarding the structure of this tag data is limited and the data structure of the testing images I found are inconsistent. The "types" are actually not treated as string but integer type. The problem is the byte order could be either big or little endian. To make things worse, it is even inconsistent with the TIFF container itself: a big endian TIFF container could have little endian 37724 tag data or vice versa. Also, there seems to be way more "types" than the 4 mentioned above.

dragon66 commented 9 years ago

Photoshop CC 2015 refused to open the 2 images which has inconsistent 37724 tag data (the size of the "Layr" type are all wrong for these 2 images). The only one Photoshop opened is the one with 37724 tag data byte order the same as the TIFF container.

dragon66 commented 9 years ago

Added simple implementation classed DDB and DDBEntry for Tag 37724. Need further work to read actual entry like "Layr" etc.

dragon66 commented 9 years ago

Added DataBlockType enum to work with DDB.

dragon66 commented 8 years ago

Added simple support for DDB