Recognize broken profile

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
slgaficon
Posts: 10
Joined: 2019-02-18T01:15:47-07:00
Authentication code: 1152

Recognize broken profile

Post by slgaficon »

Version: ImageMagick 7.0.8-27 Q16 x64
Platform: Windows

I have an image that is converted to PSD format. When opening this image in PhotoShop, it's said: The embedded ICC profile cannot be used because the ICC profile is invalid.

IM has no problem converting it to PSD format using the profile given in the headers. The profile is stored as a separate file for conversion. The IM script reads out the header information an uses the external ICC file.

Any hints how to recognize that an embedded profile is corrupt?

Image link: http://dev.dalim.gaficon.de/Esprit/shar ... 1f3e6f4eb8
slgaficon
Posts: 10
Joined: 2019-02-18T01:15:47-07:00
Authentication code: 1152

Re: Recognize broken profile

Post by slgaficon »

Effective IM command:
magick convert -units PixelsPerInch profile_04_4c_CH.jpg -units PixelsPerInch -depth 8 -density 300 +profile icc +profile 8bim -profile "icc_profiles/USWebCoatedSWOP.icc" -set profile icc_profiles/ISOcoated_v2_eci.icc converted/profile_04_4c_CH.psd
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Recognize broken profile

Post by snibgo »

Your JPG file contains RGB channels but the embedded profile is for CMYK. It seems to be a valid profile, but the wrong one for this image.

Stripping the CMYK profile and assigning a different CMYK profile won't help.
snibgo's IM pages: im.snibgo.com
slgaficon
Posts: 10
Joined: 2019-02-18T01:15:47-07:00
Authentication code: 1152

Re: Recognize broken profile

Post by slgaficon »

So, how can one detect this misstuffing of the image with IM?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Recognize broken profile

Post by snibgo »

Code: Select all

magick identify -verbose profile_04_4c_CH.jpg

  Channel statistics:
    Pixels: 7742500
    Red:
:
    Green:
:
    Blue:
:
    icc:copyright: Copyright 2000 Adobe Systems, Inc.
    icc:description: U.S. Web Coated (SWOP) v2
    icc:manufacturer: U.S. Web Coated (SWOP) v2
    icc:model: U.S. Web Coated (SWOP) v2
I know that "U.S. Web Coated" is CMYK.

IM is not concerned with the internals of profiles. It delegates profile processing to LCMS. So IM doesn't care if an RGB image has a CMYK profile. We can use external programs for that:

Code: Select all

magick in.jpg tmp.icc

iccDumpProfile.exe tmp.icc |grep "Data Color Space"
The output is:

Code: Select all

Data Color Space: CmykData
snibgo's IM pages: im.snibgo.com
slgaficon
Posts: 10
Joined: 2019-02-18T01:15:47-07:00
Authentication code: 1152

Re: Recognize broken profile

Post by slgaficon »

Thanks for clarification.
We already use exiftool and can inspect a profile with this tool as well. Generally, the color space of the image (determined by identify) hast to match the color space of the profile. Checking this will avoid psychedelic colors.
Post Reply