Embedded ICC profile is invalid in converted JPEG

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Bob Hartwig

Embedded ICC profile is invalid in converted JPEG

Post by Bob Hartwig »

I ran across a problem with the way convert handles embedded ICC profiles of Photoshop CS5-exported JPEGs.

Here's my scenario: I bring up my PSD file in Photoshop, and Save As... JPEG format with an embedded Adobe or sRGB profile, to a file named saved-by-photoshop.jpg. I run "convert saved-by-photoshop.jpg converted.jpg". I view converted.jpg in any web browser or image viewer, and notice that it looks "off". I open converted.jpg in Photoshop, and as it comes up, I get a message box stating "The embedded ICC profile cannot be used because the ICC profile is invalid. Ignoring the profile.". When I dismiss the warning message box, the file looks "off" in Photoshop. This problem also happens if I save as PNG from photoshop, and "convert saved-by-photoshop.png converted.jpg".

I originally noticed this in ImageMagick version 6.6.3-0 in MacPorts, but I repeated it in version 6.6.2-5 on Linux. This happens with every file that I export from Photoshop CS5. If you would like to see my two example files, you can download them from http://bobhartwig.com/imagemagick

Thanks!
Bob Hartwig
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Embedded ICC profile is invalid in converted JPEG

Post by Drarakel »

The profiles are ok, but maybe some programs have a problem with RGB color profiles when the image is stored as grayscale. Try that (only for RGB JPGs!): "convert saved-by-photoshop.jpg -type TrueColor converted.jpg"
Bob Hartwig

Re: Embedded ICC profile is invalid in converted JPEG

Post by Bob Hartwig »

That did it! Thanks for the great (and fast!) support.

Bob
moccaflor
Posts: 1
Joined: 2013-06-12T00:39:29-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by moccaflor »

I have a similar problem when converting JPEG or TIF files edited with Photoshop to JPEG files. These are color but not gray scale images. When opening the converted files with PS I get the error message "The embedded ICC profile cannot be used because the ICC profile is invalid". The original JPEG or TIF images have an sRGB profile embedded.

I've used the following command.

convert image_from_PS.jpg image_converted.jpg

Adding the '-type TrueColor' option as suggested for gray scale images above does not change the behavior.
I am using ImageMagick 6.8.5-9-Q16-x64 (DLL) on Windows.

Any ideas how I can get an image with correct profile?

Thanks,
Olaf
andrejus
Posts: 2
Joined: 2013-06-28T04:44:59-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by andrejus »

F:\Programs\ImageMagick-6.8.6-2\convert.exe -limit memory 250 -limit map 500 F:\Projects\image\images\EPS_TEST_COLOUR.jpg -set colorspace RGB -profile "F:\Projects\image\profiles\Adobe\RGB_Profiles\AdobeRGB1998.icc" -flatten -quality 95%% -resize 150x150 F:\Projects\image\images\test01.jpg

I am getting the same error when trying to open a newly generated file in Photoshop. However, this used to work with older version with image magick (ImageMagick-6.7.0-8), no errors shown in Photoshop.
The original jpg file has Adobe RGB 1998 ICC profile embedded.

Could this be a bug?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Embedded ICC profile is invalid in converted JPEG

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-3 Beta available by sometime tomorrow. Thanks.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Embedded ICC profile is invalid in converted JPEG

Post by glennrp »

ImageMagick, when built with libpng-1.6, is more picky about ICC profiles that it will accept.
In libpng-1.5 and earlier, the ICC profile was handled as a "black box" and just passed along.
andrejus
Posts: 2
Joined: 2013-06-28T04:44:59-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by andrejus »

magick wrote:We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-3 Beta available by sometime tomorrow. Thanks.
Great. Thanks for prompt reply!
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: Embedded ICC profile is invalid in converted JPEG

Post by areohbee »

I just noticed mogrify is messing up icc profile in v6.8.6 (6.7.3 is ok).

Is there a way to get on an email list to be notified when fix is released?

Thanks,
Rob
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Embedded ICC profile is invalid in converted JPEG

Post by magick »

Try 6.8.6-3. That should handle the ICC profile properly.
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by eduardo.melgar »

My converted file also fails when opening in Photoshop. I have a PSD file converted to TIFF using:
convert -density 250 myFile.psd -flatten -alpha transparent -clip -alpha opaque -resize 728x511 -profile sRGBProfile.icm -compress LZW result.tif
The original file (myFile.psd) has an embedded CMYK profile and waht I am trying to do is converting it to a sRGB transparent TIFF with LZW compression.
The result.tif is generated but when opening in Photoshop (Version: 12.0.4) I get the "The embedded ICC profile cannot be used because the ICC profile is invalid. Ignoring the profile" popup. After running identify I get:
Profiles:
Profile-8bim: 618656 bytes
Profile-exif: 406 bytes
Profile-icc: 557188 bytes
Description: Coated FOGRA27 (ISO 12647-2:2004)
Manufacturer: Coated FOGRA27 (ISO 12647-2:2004)
Model: Coated FOGRA27 (ISO 12647-2:2004)
Copyright: Copyright 2004-2007 Adobe Systems Incorporated

Profile-iptc: 48 bytes
City[1,90]: 0x00000000: 254700 -%
City[1,90]: 0x00000000: 254700 -%
City[1,90]: 0x00000000: 254700 -%
City[1,90]: 0x00000000: 254700 -%
City[1,90]: 0x00000000: 254700 -%
unknown[2,0]:
Profile-xmp: 49996 bytes


As you can see the Metadata is not updated. I had used the same approach with other file types (such as EPS, PDF and PJG) and the Metadata was actually updated. Is this issue also addressed on the any version of ImageMagick?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Embedded ICC profile is invalid in converted JPEG

Post by snibgo »

What version of IM? What platform?
snibgo's IM pages: im.snibgo.com
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by eduardo.melgar »

Version: ImageMagick 6.7.7-10 2013-02-25 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

And the OS is Ubuntu 13.04 32b
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Embedded ICC profile is invalid in converted JPEG

Post by snibgo »

See magick's responses above. I suggest you upgrade.
snibgo's IM pages: im.snibgo.com
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by eduardo.melgar »

Hi, I have the last version of Image Magick installed:

Code: Select all

$ convert -version
Version: ImageMagick 6.8.9-0 Q16 x86_64 2014-04-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jbig jng jpeg lcms lzma pangocairo png ps rsvg tiff webp wmf xml zlib
The OS is Ubuntu 13.04.
According with your information, this issue is fixed in version 6.8.6-3. I fount out that the issue is still there. I run a command for converting an image from an CMYK profile to an RGB profile:

Code: Select all

$ convert -quiet Daim.psd -flatten -profile /tmp/icc/CoatedFOGRA39.icc -profile /tmp/icc/AdobeRGB1998.icc test.jpg
Then I run the identify command to check the results of the conversion:

Code: Select all

identify -verbose test.jpg > test.txt
All files (Daim.psd, test.jpg and test.txt) are available at following link: https://drive.google.com/folderview?id= ... sp=sharing
The color profiles I used are available at http://download.adobe.com/pub/adobe/icc ... d-user.zip

The problem is that the JPG is not defined as an RGB and the embedded ICC profile is the original profile and not the redefined AdobeRGB1998 profile (see test.txt):

Code: Select all

photoshop:ColorMode: 4
photoshop:ICCProfile: Coated FOGRA39 (ISO 12647-2:2004)
I am aware that there are some properties in the test.txt that point to the correct ICC profile:

Code: Select all

    icc:copyright: Copyright 2000 Adobe Systems Incorporated
    icc:description: Adobe RGB (1998)
    icc:manufacturer: Adobe RGB (1998)
    icc:model: Adobe RGB (1998)
But my problem is that the file triggers a warning in photoshop when I try to open it (see screenshot.png)

Is there any fix for this color conversion issue?
Last edited by eduardo.melgar on 2014-04-14T02:11:11-07:00, edited 1 time in total.
Post Reply