PSD to PNG Color Shifting issue

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
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

PSD to PNG Color Shifting issue

Post by pssvarma8881 »

Hi ,

We are observing Color shifting when we convert the file from PSD to PNG .

Version :

Version: ImageMagick 6.9.0-0 Q16 x64 2014-11-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP

Command :

convert -verbose -units PixelsPerInch +profile 8bim -density 72 -resize 1000 %1[0] -profile "D:\Droplets\sRGB Profile.icc" "M:%MYPARAM4%%~n1.png"
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 Shifting issue

Post by fmw42 »

Please supply an example PSD and PNG results file. You can post to some place such as dropbox.com and put your URL here.

Note: you should properly be reading the PSD first then the commands, then the output

Code: Select all

convert -verbose %1[0] +profile 8bim -profile "D:\Droplets\sRGB Profile.icc" -resize 1000 -units PixelsPerInch  -density 72 "M:%MYPARAM4%%~n1.png"
Note that PNG will only support pixelspercentimeter. But IM will convert your pixels per inch properly to centimeters.

Does your PSD already have a profile? If it is Adobe RGB, then you are convert to sRGB and you would see different colors. If it has no profile, then some viewers may or may not view it with the sRGB profile, so again it might look different.
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: PSD to PNG Color Shifting issue

Post by pssvarma8881 »

I was not able to upload samples due to an access issue...I will post the link to the files described here shortly.

Two ZIP files - one batch with original as a CMYK and the other with original starting with RGB. Each ZIP file contains three files:

• 1) the original file (a PSD file in either CMYK w/a custom profile embedded or an RGB with an embedded Adobe RGB (1998) profile; 300 dpi, more than 1000 pixel width, containing multiple layers and multiple channels).
• 2) A file that was converted to the same parameters as the script manually using Photoshop CC2014 (in order the collapsed visible layers, color space was changed for CMYK, width dropped to 1000 px (no resample), resolution dropped to 72 dpi (resampled), used ‘Convert to Profile’ feature to convert image to sRGB profile, used SAVE AS (not ‘Save for Web’) command to save as a PNG).
• 3) A copy of the file generated from the original by IM using our original script…haven’t tried with your restructured script yet to see if there is any difference.

I’m seeing different issues with each of them:

Problem with CMYK Original:
Primary issue is Color shifting - comparing the PS converted file to the original looks fine even though there is a conversion from CMYK to sRGB. However, the IM converted file has a color shift in it. I suspect a Profile issue because when I open each of these files up in Photoshop and select the Document Profile to be displayed, I see sRGB (sRGB IEC61966-2.1 (8bpc) to be specific) listed. However, in the IM file I see “Untagged RGB (8bpc)”…I don’t even know what that means other than to guess “No Profile” or some other RGB profile assigned by IM, but not one recognized by Adobe.

Problem with RGB Original:
It’s nearly identical to the problem with the CMYK original except that instead of seeing a color shift, the problem is the Shadow Layer changes by drastically fading. (NOTE: this is easier to see if you put a white layer behind the primary layer (rather than transparent) in the file or place each of them on a white background.

Thanks in advance for any further advice or suggestions.
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 Shifting issue

Post by fmw42 »

Can you upload some other non-proprietary PSD file that shows the same problems?

Have you tried upgrading IM to the latest versions. There have been some fixes to PSD files since your version 6.9.0.0. See http://legacy.imagemagick.org/script/changelog.php
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: PSD to PNG Color Shifting issue

Post by pssvarma8881 »

Sorry for the lack of files yet...once again, they will be uploaded shortly (really this time). However, in the meantime, please explain what you mean by "non-proprietary PSD" files?
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 Shifting issue

Post by fmw42 »

I meant that you have images the you cannot upload because they are private to you or your company and cannot share openly. They happen to be PSD files.
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: PSD to PNG Color Shifting issue

Post by pssvarma8881 »

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 Shifting issue

Post by fmw42 »

I do not see any color shifting in your RGB image.

This works just fine for me on IM 6.9.6.2 Q16 Mac OSX. Note there have been recent improvements in IM for PSD processing. And as I said earlier, you should read the input right after convert for raster images, then do -resize, then apply the output settings. It is important to process only the first [0] flattened layer from the PSD file.

For your RGB image, I used:

Code: Select all

convert 1_ORIG_AdobeRGB_300dpi_MultiLayer_CustomProfile.psd[0] -resize 1000 +profile 8bim -profile /Users/fred/images/profiles/sRGB.icc -units pixelsperinch -density 72 1_ORIG_AdobeRGB_300dpi_MultiLayer_CustomProfile_fred.png

Code: Select all

compare -metric rmse 2_PhotoshopConverted_fromRGB.png 1_ORIG_AdobeRGB_300dpi_MultiLayer_CustomProfile_fred.png null:
484.017 (0.00738562)[/code]

So about 0.7% difference and not visually discernible to me.


For your CMYK file, I used:

Code: Select all

convert 1_ORIG_CMYK_300dpi_MultiLayer_CustomProfile.psd[0] -resize 1000 +profile 8bim -profile /Users/fred/images/profiles/sRGB.icc -units pixelsperinch -density 72 1_ORIG_CMYK_300dpi_MultiLayer_CustomProfile_fred.png
I do see the color shift in the CMYK image and have already reported that earlier this week when testing the PSD processing to convert a similar image to another PSD file.

However, I see that there is a difference in color profiles, here. Your png reports no sRGB profile.

From identify -verbose image

Your file:

Code: Select all

 Properties:
    date:create: 2016-10-21T14:55:40-07:00
    date:modify: 2016-10-20T11:59:42-07:00
    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: 6
    png:IHDR.color_type: 6 (RGBA)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 1000, 1145
    png:pHYs: x_res=2835, y_res=2835, units=1
    signature: 4b10d34d61c028676293f220660335922352121b034411694dab75c1cd676f57
My file:

Code: Select all

  Properties:
    date:create: 2016-10-21T15:14:52-07:00
    date:modify: 2016-10-21T15:14:52-07:00
    icc:copyright: sRGB built-in
    icc:description: sRGB built-in
    icc:manufacturer: (lcms internal)
    icc:model: sRGB built-in
    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: 6
    png:IHDR.color_type: 6 (RGBA)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 1000, 1145
    png:pHYs: x_res=2834, y_res=2834, units=1
    png:text: 11 tEXt/zTXt/iTXt chunks were found
    png:text-encoded profiles: 3 were found
    png:tIME: 2016-09-30T03:51:08Z
    signature: 3a13ca38271df26ec31a79e256f22e33d033551ee5bf9321263b8e485692440f
    tiff:XResolution: 300
    tiff:YResolution: 300
  Profiles:
    Profile-exif: 1326 bytes
    Profile-icc: 6876 bytes
    Profile-iptc: 103 bytes
      unknown[1,0]: 
      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                                        -%
      City[1,90]: 0x00000000: 254700                                        -%
      unknown[2,0]: 
      Keyword[2,25]: doll care
      Keyword[2,25]: hair care
      Created Date[2,55]: 20120207
    Profile-xmp: 14336 bytes
This may be an issue with what sRGB.icc profile you used or your version of libpng or you forgot to add -profile ... sRGB.icc or a bug in IM.

Mine is (from convert -list format)

PNG* PNG rw- Portable Network Graphics (libpng 1.6.24)
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 Shifting issue

Post by fmw42 »

See my updates above
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: PSD to PNG Color Shifting issue

Post by pssvarma8881 »

Hi
Can you please point me the installer URL for download for below version ?

ImageMagick-6.9.6-2
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD to PNG Color Shifting issue

Post by snibgo »

It's on the binary distribution web page: http://legacy.imagemagick.org/script/bi ... hp#windows
snibgo's IM pages: im.snibgo.com
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: PSD to PNG Color Shifting issue

Post by pssvarma8881 »

Hi ,

1 . Problem with RGB Original: Problem is the Shadow Layer changes by drastically fading .Is there a we can retain the shadow layers ?
2 . Problem with CMYK Original: When we convert this file to RGB Conversion we observe Colorshifing .Please confirm if any of the MB version can fix this issue .
3 . Problem with ColorProfile : We observe that After conversion with IM converted did not have any XMP values in it though source file have XMP data .Is there a way we can retain the XMP values from Source ?

Thanks in advance for any advice.
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 Shifting issue

Post by fmw42 »

In viewtopic.php?f=1&t=30698#p139095 above, I showed that there is no loss of shadow. Perhaps you have not used the command exactly as I wrote or your IM version is not current enough.

With respect to the xmp data, my conversion above for RGB shows an xmp file.

Code: Select all

  Profiles:
    Profile-exif: 310 bytes
    Profile-icc: 6876 bytes
    Profile-iptc: 52 bytes
      City[1,90]: 0x00000000: 254700                                        -%
      unknown[2,0]: 
      Created Date[2,55]: 20110124
      Created Time[2,60]: 000000+0000
      City[2,90]:  %G
    Profile-xmp: 14693 bytes
The only issue I found was the color shift for CMYK and that issue has been sent to the IM developers to look into when they have time.
Post Reply