Color issue converting from eps to png

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
dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Color issue converting from eps to png

Post by dynammic1 » 2018-07-03T09:05:51-07:00

Hi,
I hope someone can help. Been working on this for weeks and cannot seem to get the color of the at&t logo to convert to png with the same color. The original eps file in RGB mode has 0,178,237. The closest RGB color I can achieve is 27,183,212

Here's what i used:
convert -density 1200 -define png:preserve-iCCP -colorspace sRGB -type truecolor -resize 2000x2000 -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/sRGB2014.icc -background transparent ${file} PNG32:unused_thumbnail.png


Thank you since i've been tirelessly trying many combinations.

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-03T10:03:37-07:00

Can you post your EPS file to some free hosting service and put the URL here? Please always provide you IM version and platform when asking questions here, since syntax may vary.

Have you tried removing the -colorspace sRGB and using one or two profiles after reading the EPS file depending upon whether the EPS has a profile or not. Use one output profile if there is an input profile with the image. Use two profiles if the EPS has no imbedded profile.

dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Re: Color issue converting from eps to png

Post by dynammic1 » 2018-07-03T12:41:55-07:00

I'm using Version: ImageMagick 6.9.9-21 Q16 x86_64 Ghostscript: 9.07

Here's the link to EPS file: https://www.dropbox.com/s/ozwr8dkhxf1hv ... v.eps?dl=0

If you view the eps in photoshop you will see the logo and the word "DirectTV" next to the logo. The letters are white.

When I run convert -density 1200 -define png:preserve-iCCP -colorspace sRGB -type truecolor -resize 2000x2000 -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/sRGB2014.icc -background transparent ATT_DTV_4CP_Sol_Rev.eps PNG32:unused_thumbnail.png

the color is off as mentioned in my initial post but I retains the tranparent background (which shows the white letters of the word DirectTV.

However, when i run this:
convert -density 1200 -define png:preserve-iCCP -resize 2000x2000 -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/Photoshop5DefaultCMYK.icc -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/sRGB2014.icc -background transparent ATT_DTV_4CP_Sol_Rev.eps PNG32:unused_thumbnail.png

the png color is closely matched with the original eps color. However, i lose all the transparency and the word DirectTV disappears and the background is all white.

How to i fix the second command to retain the word DirectTV?

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-03T12:54:39-07:00

Imagemagick uses ghostscript. Ghostscript cannot handle transparent CMYK images. So you have to use -colorspace sRGB as you had originally. This seems to work well for me on IM 6.9.10.3 Q16 Mac OSX with GS 9.23

Code: Select all

convert -density 1200 -colorspace sRGB ATT_DTV_4CP_Sol_Rev.eps -profile /Users/fred/images/profiles/sRGB.icc ATT_DTV_4CP_Sol_Rev.png
Image

Perhaps you need to upgrade your version of Ghostscript?

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-03T13:01:22-07:00

If you are going to resize, do it after adding the profile.

Code: Select all

convert -density 1200 -colorspace sRGB ATT_DTV_4CP_Sol_Rev.eps -profile /Users/fred/images/profiles/sRGB.icc -resize 2000x2000 ATT_DTV_4CP_Sol_Rev_resize.png
Image

dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Re: Color issue converting from eps to png

Post by dynammic1 » 2018-07-03T13:26:43-07:00

By using -colorspace sRGB the generated png's color is way off from the original eps. Any suggestion to get the png color close to the eps?

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-03T14:49:54-07:00

Visually they look close to me. But there is a difference. But that depends upon the device used to measure the colors. I tried two different tools and got two different results for the rmse difference.

Code: Select all

compare -metric rmse xc:"#00A6D7" xc:"#40AFEB" null:
15.3176%

Code: Select all

compare -metric rmse xc:"rgb(0,150,207)" xc:"rgb(0,176,236)" null:
8.81844%

As to making them closer, I do not know how to do that with Imagemagick, since it relies upon Ghostscript and Ghostscript is limited with regard to CMYKA conversion, such that you cannot keep transparency if you want to use profiles only.

I tried using Photoshop to export the EPS to sRGB PNG with sRGB profile and get the very same results as with Imagemgick.

One possibility is that your EPS has spot colors and Imagemagick cannot handle them. But then I would have expected Photoshop to do better, since it can use spot colors. But I got the same results.

snibgo
Posts: 10954
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Color issue converting from eps to png

Post by snibgo » 2018-07-03T15:17:00-07:00

It seems you have two results:

1. Correct colours but no transparency.
2. Bad colours but correct transparency.

A solution is to "copy opacity" from the second to the first.
snibgo's IM pages: im.snibgo.com

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-03T15:46:04-07:00

snibgo wrote:
2018-07-03T15:17:00-07:00
It seems you have two results:

1. Correct colours but no transparency.
2. Bad colours but correct transparency.

A solution is to "copy opacity" from the second to the first.
Good idea!

Code: Select all

convert -density 300 -colorspace sRGB ATT_DTV_4CP_Sol_Rev.eps -alpha extract miff:- \|
convert -density 300 ATT_DTV_4CP_Sol_Rev.eps \
-profile /Users/fred/images/profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
- -alpha off -compose copy_opacity -composite ATT_DTV_4CP_Sol_Rev.png
But this gave the same result as before.

Trying a different CMYK profile:

Code: Select all

convert -density 300 -colorspace sRGB ATT_DTV_4CP_Sol_Rev.eps -alpha extract miff:- |\
convert -density 300 ATT_DTV_4CP_Sol_Rev.eps \
-profile /Users/fred/images/profiles/GenericCMYKProfile.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
- -alpha off -compose copy_opacity -composite -depth 8 ATT_DTV_4CP_Sol_Rev.png
give only a 4.46554% difference, so closer.

Perhaps the OPs CMYK profile will do better.

dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Re: Color issue converting from eps to png

Post by dynammic1 » 2018-07-05T08:38:11-07:00

Hope everyone had a nice 4th!
Thank you very much for the command to get the color and transparency more accurately. That command works well for eps file, but the color is badly off on an AI file. I used the same command to run the convert on the AI to png and the transparency is fine but the color is no where close to the original AI file.

Here's the file: https://www.dropbox.com/s/fzuceii6yrneg ... st.ai?dl=0

Here's the command you proposed (works great for eps, not well for ai):
convert -density 300 -colorspace sRGB ${file} -alpha extract miff:- | convert -density 300 ${file} -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/GenericCMYKProfile.icc -profile /opt/app/workload/opt/IMAGEMAGICK/colorProfiles/sRGB2014.icc - -alpha off -compose copy_opacity -composite -depth 8 –resize 2000x2000 PNG32:unused_thumbnail.png

file=ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.ai

Again appreciate all your suggestion!

NOTE: all images taken from dropbox is the property of AT&T and cannot be used for any other purpose except for this thread in this forum only. Outside use of this forum is prohibited.

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-05T09:44:56-07:00

I get:

Code: Select all

convert -density 300 -colorspace sRGB ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.ai -alpha extract miff:- |\
convert -density 300 ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.ai \
-profile /Users/fred/images/profiles/GenericCMYKProfile.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
- -alpha off -compose copy_opacity -composite -depth 8 test.png

Code: Select all

compare -metric rmse xc:"rgb(0,159,229)" xc:"rgb(0,166,216)" null:
3.34293%

For the blue color.

dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Re: Color issue converting from eps to png

Post by dynammic1 » 2018-07-05T11:40:28-07:00

hi,
the only thing different I did was instead of using sRGB.icc I used sRGB2014.icc and the color is off and the transparency isn't right ('DirectTV' text doesn't appear).

Here's the comparison of the images: https://www.dropbox.com/s/06y5rbv580bxxcs/AI.docx?dl=0
Notice that the resulting png , the transparency just shows the blank white background whereas the original AI has the text.

You said you saw both the blue globe and the text (DirecTV) or just the blue globe?

Maybe, both of my profiles are differ than yours.
Perhaps you can tell me where to download sRGB.icc (or share download link) ? Similarly I downloaded the GenericCMYKProfile.icc but not sure if it's similar to yours, so if you can tell me where to download it?

Besides that I don't why what I'm seeing is different than what you see.

Thanks.

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

Re: Color issue converting from eps to png

Post by fmw42 » 2018-07-05T12:46:30-07:00

Here is my result.

Code: Select all

convert -density 300 -colorspace sRGB ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.ai -alpha extract miff:- |\
convert -density 300 ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.ai \
-profile /Users/fred/images/profiles/GenericCMYKProfile.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
- -alpha off -compose copy_opacity -composite -depth 8 ATT_DTV4BIZNIZ_25Yrs_NFLST_Lockup_logo_KO_tagline_Rev_4C_test.png
Image

Upgrade your version of Ghostscript! 9.07 is ancient. I am using 9.23

dynammic1
Posts: 6
Joined: 2018-07-03T08:46:36-07:00
Authentication code: 1152

Re: Color issue converting from eps to png

Post by dynammic1 » 2018-07-05T14:00:32-07:00

Okay, thank you very much for your help!

Post Reply