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.
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 »

The listing shows that test.jpg is RGB but contains two profiles:

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)
    :
    photoshop:ColorMode: 4
    photoshop:ICCProfile: Coated FOGRA39 (ISO 12647-2:2004)
I suppose ImageMagick has ignored this extra Photoshop profile.

After doing the conversion, you can remove both profiles, then insert the correct one:

Code: Select all

convert -quiet Daim.psd -flatten -profile CoatedFOGRA39.icc -profile AdobeRGB1998.icc -strip -profile AdobeRGB1998.icc t2.jpg
The result, t2.jpg, contains only AdobeRGB1998, looks the same as your test.jpg, and "compare" reports a zero difference.
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,
The workaround will definitely remove the incorrect ICC profile (adding a new ICC after the -strip option). Unfortunately all other metadata will be removed as well (like clipping path).
A more precise workaround could be removing only the XMP metadata (with +profile "xmp").
Removing entire sets of metadata is not a good idea anyway. I think Image Magick should address this issue: it is obvious that the ICC profiles are not in sync, even they are in different namespaces.
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 »

eduardo.melgar wrote:A more precise workaround could be removing only the XMP metadata (with +profile "xmp").
True, it would be more precise, but sadly doesn't remove the PS profile.

Code: Select all

convert daim.psd[0] -profile CoatedFOGRA39.icc -profile AdobeRGB1998.icc +profile "xmp" t2.jpg

identify -verbose t2.jpg

    icc:copyright: Copyright 2000 Adobe Systems Incorporated
    icc:description: Adobe RGB (1998)
    icc:manufacturer: Adobe RGB (1998)
    icc:model: Adobe RGB (1998)
    illustrator:StartupProfile: Print
    illustrator:Type: Document
:   :
    photoshop:ColorMode: 4
    photoshop:ICCProfile: Coated FOGRA39 (ISO 12647-2:2004)
+profile "*" should remove both profiles, and it does, but sadly it also removes the clipping path. (I don't think it should, so that looks like a bug. IM 6.8.9-0 on Windows 8.1.)

The most reliable solution might be to do the conversion in IM, then use exiftool to remove any Photoshop profile.
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 again,

It is not enough removing the two properties in Exiftool to create a (photoshop)readable JPG.
I will use the command +profile "8bim,xmp" by now, even that command also removes the clipping path.
Do you know if this issue will be marked (as I understand, it should be) as BUG and eventually when we can expect to have it solved?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Embedded ICC profile is invalid in converted JPEG

Post by dlemstra »

Can you try to open this file in Photoshop: https://www.dropbox.com/s/7yi5z2ymve07xrf/Daim.jpg? It is only missing the xmp profile. I have added a patch that will update the 8bim profile when the xmp profile is removed or changed. I only used +profile xmp.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
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,
Unfortunately you patch don't resolve the issue I am reporting: after downloading from https://www.dropbox.com/s/7yi5z2ymve07xrf/Daim.jpg I try to open it in photoshop, but I still get the "screenshot.png" warning from https://drive.google.com/folderview?id= ... sp=sharing
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Embedded ICC profile is invalid in converted JPEG

Post by dlemstra »

Can you try again? I have now updated the 8bim profile with the new icc profile.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
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,

Photoshop accepts now the image without complaining. Is your solution a patch for IM or I should wait for the next version?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Embedded ICC profile is invalid in converted JPEG

Post by dlemstra »

If you are building IM from source you could should grab the latest version of profile.c from our svn repository. Otherwise you will have to wait for the next version that includes this change. The image was created with the following command:

Code: Select all

convert -quiet Daim.psd[0] -profile CoatedFOGRA39.icc -profile AdobeRGB1998.icc Daim.jpg
You don't need to use Daim.psd -flatten you can use Daim.psd[0]. The latest version of ImageMagick will automatically create the 'merged'/'flattened' image if the PSD file does not contain one.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
jdo
Posts: 3
Joined: 2014-10-03T07:37:56-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by jdo »

[17:01:56] kataross: Hi,

We are facing the exact same issue, even with the latest version of ImageMagick.
The Image is detected as a grayscale (not RGB) and photoshop is complaining while opening the converted one.

We tried all the command you suggested but none of them seem to work (the 8bim is still corrupted).

Here is a sample file : http://we.tl/ujC89jgWGX

Thanks for your help
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 »

Your image seems to have at least four copies of the sRGB profile in it. One in the ICC profile, one in the Adobe-XMP profile, and at least two in the 8bim profile.
jdo
Posts: 3
Joined: 2014-10-03T07:37:56-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by jdo »

Is it a problem for ImageMagick?
The original image is exported using photoshop.
Is it possible to force rgb rendering and avoid the error when opening in photoshop without losing the clipping path?
jdo
Posts: 3
Joined: 2014-10-03T07:37:56-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by jdo »

We have fixed color issues by updating picutres library (jpeg,png ...).

But we can't find a way to fix error whil opening in photoshop.
Do you have any idea to fix the warning?
CatBurgers
Posts: 9
Joined: 2014-10-03T11:56:34-07:00
Authentication code: 6789

Re: Embedded ICC profile is invalid in converted JPEG

Post by CatBurgers »

I'm having a similar issue with this file: http://3fc68be784075022e210-30c1eab61c3 ... ag01BW.jpg

Using the command:

Code: Select all

convert file.jpg -auto-orient output.jpg
I get the aforementioned 'The embedded ICC profile cannot...' error in Photoshop CS 6 when trying to open the output file. I'm using the latest IM static build for windows.

Using '-type TrueColor' removes the error message for this particular image, however I need a solution that can be automated and will work for all color profiles.

Interestingly, this file: http://3fc68be784075022e210-30c1eab61c3 ... ng-171.jpg gives the same error when opening in Photoshop, however after having been processed by imagemagick, the error message doesn't appear for the output file.
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 »

The American flag image is a grayscale JPEG. It contains at least two sRGB profiles. Grayscale images are only allowed to have grayscale ICC profiles.
Post Reply