PSD to PNG - Color profile issues.

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
PMLaura
Posts: 12
Joined: 2013-04-23T22:15:25-07:00
Authentication code: 6789

PSD to PNG - Color profile issues.

Post by PMLaura »

Hi All

I'm trying to setup ImageMagic to convert psd files (with "Adobe RGB (1998)" embedded color profile) that have been optimised for print, to sRGB (with sRGB colour profile) PNGs for iPad development.

Currently I have ImageMagick installed on my Mountain Lion Mac - installed using Mac Ports - so version 6.8.0-7 (I see the latest version is 6.8.4.10.. perhaps this is part of the problem)

If I do just a straight convert:

convert file.psd file.png

when I attempt to open the converted png in Photoshop I get an error about the profile stating: "The RGB document has a file format that does not support embedded color profiles"

I've read a lot of the documentation regarding profiles and PNGs but I guess I am still missing something because no amount of fiddling seems to be working.

I guess the question is can ImageMagick generate PNGs with embedded color profiles ?

I CAN convert from the Adobe RGB based profile to the sRGB profile if I convert from PSD to PSD it's when I convert to PNG that I lose it

Thanks for any assistance!

-- Laura
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD to PNG - Color profile issues.

Post by fmw42 »

It should work fine by adding the Adobe profile and changing it to an sRGB profile.

convert image.psd -profile path2/theimbeddedAdobeprofile.icc -profile path2/sRGB.icc image.png

You must have both profiles on your system and provide the proper path to them.

I am not sure it is an issue, but what version of libpng do you have installed?

see
http://www.imagemagick.org/Usage/formats/#profiles
PMLaura
Posts: 12
Joined: 2013-04-23T22:15:25-07:00
Authentication code: 6789

Re: PSD to PNG - Color profile issues.

Post by PMLaura »

Thanks so much for your reply

I tried as your suggested defining both profiles as follows (with appropriate paths which I removed here for brevity):

convert Original.psd -profile AdobeRGB1998.icc -profile sRGB\ Color\ Space\ Profile.icm converted.png

and unfortunately I'm getting the same error and when I try open it in Photoshop.

Interestingly "identity" shows it has a profile but it's the original Adobe RGB profile

libpng appears to be version 1.5.15
PMLaura
Posts: 12
Joined: 2013-04-23T22:15:25-07:00
Authentication code: 6789

Re: PSD to PNG - Color profile issues.

Post by PMLaura »

Oh, also on further reading, assuming I'm understanding correctly, if an image has a profile embedded already you only define the output profile?

So I also tried:

convert Original.psd -profile sRGB\ Color\ Space\ Profile.icm converted.png

With the same result
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD to PNG - Color profile issues.

Post by fmw42 »

convert Original.psd -profile AdobeRGB1998.icc -profile sRGB\ Color\ Space\ Profile.icm converted.png
What is this: sRGB\ Color\ Space\ Profile.icm

why the backslashes? are these subdirectories? why the spaces? If you have spaces in your directory names, then you need to quote them

I know of no profile called Profile.icm.

if you don't have spaces, then I am confused.

What I would have in my system would be

convert image.psd -profile path2/AdobeRGB1998.icc -profile path2/sRGB.icc result.png

where my path2/ would be /User/fred/profiles/ which is where I keep all my profiles.
PMLaura
Posts: 12
Joined: 2013-04-23T22:15:25-07:00
Authentication code: 6789

Re: PSD to PNG - Color profile issues.

Post by PMLaura »

Hi there, thanks again for your response

The backslashes escape the spaces in the profile name (standard unix practice) you can either use quotes to enclose a filename with spaces or escape them with backslashes

so basically

"A file with spaces" and a\ file\ with\ spaces

are equivalent.

Just to be sure I tested once again with the whole path quoted rather than using the escaped backslashes with the same result
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD to PNG - Color profile issues.

Post by fmw42 »

Try replacing

sRGB\ Color\ Space\ Profile.icm

with sRGB.icc. See http://www.color.org/srgbprofiles.xalter

I have never seen a profile called "sRGB Color Space Profile.icm" Where did you get that? Perhaps PS does not like icm profiles and wants an icc profile.

If that does not work, then can you post a link to your input psd image?

Can you upgrade to the latest IM version?

Are your profiles in the same directory with your images and the directory from where you are issuing your command line? If not IM is then not finding the profiles. That is why I suggested a full path to where the profiles are stored.
PMLaura
Posts: 12
Joined: 2013-04-23T22:15:25-07:00
Authentication code: 6789

Re: PSD to PNG - Color profile issues.

Post by PMLaura »

Hi there
I haven't posted the full path to the files and colour profiles in my replies because it would make the post very messy. The paths are correct when I'm actually using the command. Image Magick is not error-ing in any way.

However, I did test your suggestion and put all files and profiles into a single directory unfortunately to no avail - this shouldn't matter if the paths are correct,

"sRGB Color Space Profile.icm" is the colour profile provided by Adobe which I've been told is the one we need to use.

I also saved it out of Color Utility as an icc and used it, just to check, and the same thing happens when I open the converted PNG

I also downloaded the suggested colour profile and unfortunately the same thing is still happening

It's like Photoshop doesn't like the way IM is generating the PNG or at least, doesn't see the

So sad coz image magick does everything else I need it to do I'm just stumbling at the last hurdle.

I'm not using any particular PSD, I even generated one myself from Photoshop CS5.5 to see if that made any difference and it didnt

Oh and I did update IM to the latest and I get a png that photoshop wont even open even though Preview.app will, go figure!

I appreciate your time.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD to PNG - Color profile issues.

Post by snibgo »

I don't use Photoshop and have no idea what the problem is. But it might be helpful if you could put the file that Photoshop complains about on the web somewhere and post the URL here.

Failing that, do a "identify -verbose" and post the output here, between [ code ] and [ /code ] to preserve the formatting.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD to PNG - Color profile issues.

Post by fmw42 »

OK. I repeated your process on my Mac OSX Snow Leopard with IM 6.8.5.1 and Photoshop CS.

I took an image, opened it in PS, saved it as psd with the AdobeRGB (1998).icc profile and verified in IM that the profile was correct. Then used the following to convert to sRGB.icc profile

convert zelda3.psd -profile "/Users/fred/images/Profiles/AdobeRGB (1998).icc" -profile /Users/fred/images/Profiles/sRGB.icc zelda3.png

Afterwards the verbose information for the png, still shows the AdobeRGB (1998) profile.

Code: Select all

  Properties:
    date:create: 2013-04-26T09:33:20-07:00
    date:modify: 2013-04-26T09:33:20-07:00
    dc:format: application/vnd.adobe.photoshop
    exif:ColorSpace: 4294967295
    exif:PixelXDimension: 128
    exif:PixelYDimension: 128
    photoshop:History: 
    png:bKGD                 : chunk was found (see Background color, above)
    png:cHRM                 : chunk was found (see Chromaticity, above)
    png:iCCP                 : chunk was found
    png:IHDR.bit-depth-orig  : 8
    png:IHDR.bit_depth       : 8
    png:IHDR.color-type-orig : 2
    png:IHDR.color_type      : 2 (Truecolor)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height    : 128, 128
    png:pHYs                 : x_res=2834, y_res=2834, units=1
    png:text                 : 17 tEXt/zTXt/iTXt chunks were found
    png:text-encoded profiles: 3 were found
    signature: facf2f8ddcd698d3629e8ffd6e9660c94347b2fb371aa7131bd8e7f9c03f1117
    tiff:XResolution: 72
    tiff:YResolution: 72
    xap:CreateDate: 2013-04-26T09:25:49-07:00
    xap:CreatorTool: Adobe Photoshop CS Macintosh
    xap:MetadataDate: 2013-04-26T09:25:49-07:00
    xap:ModifyDate: 2013-04-26T09:25:49-07:00
    xapMM:DocumentID: adobe:docid:photoshop:2c2dc8e5-afe5-11e2-a3f2-ef71bf1e96cf
  Profiles:
    Profile-8bim: 19196 bytes
    Profile-exif: 302 bytes
    Profile-icc: 560 bytes
      Description: Adobe RGB (1998)
      Manufacturer: Adobe RGB (1998)
      Model: Adobe RGB (1998)
      Copyright: Copyright 1999 Adobe Systems Incorporated
    Profile-xmp: 6139 bytes
  Artifacts:
    filename: zelda3.png
I repeated it saving to jpg and still got the same thing. I tried several older versions of IM (67410 and 6839) and got the same results.

However, the png image opens fine for me in PS and does show the correct sRGB profile.

NOTE that you can set the Color Management to notify you of mismatches between embedded and working profiles in PS. Look under the Photoshop menu for Color Settings. Set the Color Management Policies as desired to Preserve or Convert and set the Working Space as desired and check the Profile Mismatches checkboxes as desired. If you set them to Ask, then when you open an image it will tell you if there is a mismatch and allow you to choose which one to use. In my case I have the working set to sRGB. So when I open the psd with Adobe RGB it asks me to keep it or convert to the sRGB. But when I open the png, it opens it without asking. Therefore it is already sRGB.

Perhaps you Color Management is OFF and thus PS does not know what to do about the profiles and so objects.


This should be reported on the bugs forum so that the IM developers could take a look as to why it does not report the sRGB profile in the png or jpg output file
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD to PNG - Color profile issues.

Post by snibgo »

fmw42 wrote:I took an image, opened it in PS, saved it as psd with the AdobeRGB (1998).icc profile and verified in IM that the profile was correct. Then used the following to convert to sRGB.icc profile

convert zelda3.psd -profile "/Users/fred/images/Profiles/AdobeRGB (1998).icc" -profile /Users/fred/images/Profiles/sRGB.icc zelda3.png
If I understand the IM profile mechanism, the first "-profile" in your command is superfluous (but harmless).

As the file already contains a profile, each "-profile" is a request to convert the image to the new profile. Your first profile is identical to the file's profile, so should have ne effect. The second "-profile" does convert the data.

Is my understanding wrong?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD to PNG - Color profile issues.

Post by fmw42 »

As the file already contains a profile, each "-profile" is a request to convert the image to the new profile.
I am no expert on profiles, but my understanding was that one needed to specify the profile in the image for the first profile and then the desired output profile, so that IM knows how to convert from one profile to the other. I am not aware that IM looks at the meta data to find the profile and use whatever it finds. I believe that it is up to the user to identify the imbedded profile and use it as the first profile.

However, http://www.imagemagick.org/Usage/formats/#profiles seems to agree with your statement.

So trying all these combinations, I still find that the verbose info shows the original Adobe RGB profile and not the sRGB profile


convert zelda3.psd -profile "/Users/fred/images/Profiles/AdobeRGB (1998).icc" -profile /Users/fred/images/Profiles/sRGB.icc zelda3a.png
convert zelda3.psd -profile /Users/fred/images/Profiles/sRGB.icc zelda3b.png
convert zelda3.psd +profile icc -profile "/Users/fred/images/Profiles/AdobeRGB (1998).icc" -profile /Users/fred/images/Profiles/sRGB.icc zelda3c.png
convert zelda3.psd +profile icm -profile "/Users/fred/images/Profiles/AdobeRGB (1998).icc" -profile /Users/fred/images/Profiles/sRGB.icc zelda3d.png


All four of them open fine in PS without asking to change the embedded profile to the working profile which is sRGB. So I believe that the profile has actually been changed from Adobe RGB to sRGB.
Post Reply