Color Space information from image files (PSD, PSB, AI)

Started by joseph, May 07, 2016, 07:52:57 PM

Previous topic - Next topic

joseph

I'm running exiftool on several PSD, PSB, and AI files to extract color space information.  For many of these files, I'm not receiving any kind of color space value.  When I examine the files, I'm not seeing a Color Space value to use.  I do some times see other values such as Swatch Groups Colorant Mode, Color Space Data, etc.  Are these accurate? Am I missing something when extracting the metadata from these files?  I'm currently running the tool without any flags set.

Phil Harvey

There is much image information in these file types that is not currently extracted.  Without checking the photoshop specification I couldn't say whether or not color space information is extracted, but it sounds like it isn't.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

joseph

Thanks Phil.  I'm getting different results, but these files should all be prepped with the same version of Photoshop CC 2015 (15.1.2).  Is there anything I can send you that would help you determine whether the Color Space can be extracted?

joseph

This is the tag in the illustrator file that I'm looking for: %AI9_ColorModel: 2

I grabbed that from examining the illustrator file in a text editor.  Is there a way to extract this using exiftool?

Phil Harvey

Quote from: joseph on May 20, 2016, 06:07:05 PM
Is there a way to extract this using exiftool?

It depends on where the tag is located.  ExifTool will extract it with the name AI9_ColorModel if it is in the document header.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

joseph

I took a look at it closer and it doesn't appear to be in the document header.  It's embedded somewhere in the middle of the AI file between %!PS-Adobe-3.0 and %%EndComments.

Phil Harvey

I would think it should be extracted if it is in the comments section.  Can you send me a sample?  (philharvey66 at gmail.com)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

joseph

I just sent you an email.  Also wondering about colorspace in jpeg files.  I've attached the jpeg example file.

In ImageMagick, it will show up as sRGB, but does not display any color profile with exiftool.

Phil Harvey

I got the AI sample.  Looking at the exiftool -v4 output, I can see the AI9_ColorModel tag inside the AIMetaData stream that ExifTool currently isn't decoding.  I will look into decoding this metadata, but I don't know if this will help you much (AI9_ColorModel has a value of "2" -- is this meaningful to you?)

The JPEG you posted has no color space information, so I presume that ImageMagick is defaulting to sRGB.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

joseph

Thanks again for taking a look.  The value for AI9_ColorModel is very helpful to me.  If it has a value of 1, then the Color Model is RGB.  If it has a value of 2, then the Color Model is CMYK.

Thanks for also looking at the JPEG.  The exiftool helps a lot with this since we're just looking at the number of color components to determine 3 (RGB) vs 4 (CMYK).

Stephen Marsh

Quote from: Phil Harvey on May 27, 2016, 04:07:43 PM
I got the AI sample.  Looking at the exiftool -v4 output, I can see the AI9_ColorModel tag inside the AIMetaData stream that ExifTool currently isn't decoding.  I will look into decoding this metadata
- Phil

There is no exiftool -AI9_ColorModel FILE command, so did this hit a brick wall?

I can see the text buried deep in the -v4 dump, but how to make use of it?

Phil Harvey

Sorry Stephen, I dropped the ball on this one.

I can add the ability to extract any of this from the file you sent:

%AI5_FileFormat 13.0
%AI12_BuildNumber: 147
%AI3_ColorUsage: Color
%AI7_ImageSettings: 0
%%CMYKProcessColor: 1 1 1 1 ([Registration])
%AI3_Cropmarks: -24.3396107530862 -27.5621559669089 875.660389246914 572.437844033093
%AI3_TemplateBox: 425 130 425 130
%AI3_TileBox: -208.979855995178 -123.562155966909 1015.02014400482 668.437844033091
%AI3_DocumentPreview: None
%AI5_ArtSize: 14400 14400
%AI5_RulerUnits: 6
%AI9_ColorModel: 2
%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0
%AI5_TargetResolution: 800
%AI5_NumLayers: 2
%AI17_Begin_Content_if_version_gt:17 1
%AI9_OpenToView: -323.5 581.5 1 1495 600 18 1 0 70 154 0 0 0 1 1 0 1 1 0 0
%AI17_Alternate_Content
%AI9_OpenToView: -323.5 581.5 1 1495 600 18 1 0 70 154 0 0 0 1 1 0 1 1 0 0
%AI17_End_Versioned_Content
%AI5_OpenViewLayers: 73
%%PageOrigin:0 0
%AI7_GridSettings: 72 8 72 8 1 0 0.800000011920929 0.800000011920929 0.800000011920929 0.899999976158142 0.899999976158142 0.899999976158142
%AI9_Flatten: 1
%AI12_CMSettings: 00.MO


Is there anything else useful to you besides the ColorModel?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Stephen Marsh

Hi Phil, sorry for dredging up an old topic, however I was looking to identify whether native Adobe Illustrator files were RGB or CMYK mode and found this topic.

I am not sure what else will be useful from that chunk of data, you know how it goes – it is only useful when one has a need for it! :]

I was thinking of something similar to:

exiftool -if '$AI9_ColorModel eq "1"' -label='Review' -execute -if '$AI9_ColorModel eq "2"' -label='Select' -execute -common_args -r 'DIR'

Or perhaps:

exiftool -if '$AI9_ColorModel eq "1"' -directory=%d'RGB AI File' -execute -if '$AI9_ColorModel eq "2"' -directory=%d'CMYK AI File' -common_args -r 'DIR'


Phil Harvey

OK Stephen,

ExifTool 10.93 (just released) extracts this as "AIColorModel", and the values are converted as 1=sRGB and 2=CMYK, so your first command should look like this:

exiftool -if '$AIColorModel eq "sRGB"' -label='Review' -execute -if '$AIColorModel eq "CMYK"' -label='Select' -execute -common_args -r 'DIR'

I've also extracted these tags for the fun of it:

AIColorUsage     
AIRulerUnits     
AITargetResolution
AINumLayers       
AIFileFormat     
AICreatorVersion 
AIBuildNumber   

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Ooops.  I just realized this should probably be "RGB", not "sRGB" :(

Maybe use -if '$AIColorModel =~ /RGB/' to be compatible with 10.94 if I change this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).