Page 2 of 2
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T09:16:09-07:00
by fmw42
Replace -colorspace RGB (which should have been -colorspace sRGB) with your final sRGB.icc profile. I have never heard of -alpha flatten. Also -alpha remove may need you to specify a background color. I am not sure what the default is. It may not be needed due to the -flatten again depending upon the default background color. Usually you can just set a background color and -flatten. Since JPG does not support transparency, removing the alpha should not be needed.
Code: Select all
D:\>ImageMagick_693_Q8\convert -density 300 Diet7up.eps ^
-profile D:\ImageMagick_693_Q8\USWebCoatedSWOP.icc ^
-profile D:\ImageMagick_693_Q8\AdobeRGB1998.icc ^
-resize 128x128 -quality 95 test.jpg
The above worked well for me in equivalent Unix syntax on IM 6.9.3.8 Q16 Mac OSX.
However, when looking at the verbose information for your EPS file, I see it already has a USWebCoatedSWOP.icc profile. So the following is sufficient (leaving out the first profile that your file already contains).
Code: Select all
D:\>ImageMagick_693_Q8\convert -density 300 Diet7up.eps ^
-profile D:\ImageMagick_693_Q8\AdobeRGB1998.icc ^
-resize 128x128 -quality 95 test.jpg
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T11:52:20-07:00
by broberts
I didn't realize the profile would actually change the document colorspace (if I would have had it right)
I tested it out and it works perfectly. I was totally over complicating things. I really appreciate you helping me with this.
+1fmw42
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T13:41:14-07:00
by broberts
so, I went back and removed the input profile per suggestion...in doing so the color got a little whacky again. I put it back in all good.
D:\>ImageMagick_693_Q8\convert -density 300 Diet7up.eps ^
-profile D:\ImageMagick_693_Q8\USWebCoatedSWOP.icc ^
-profile D:\ImageMagick_693_Q8\AdobeRGB1998.icc ^
-resize 128x128 -quality 95 test.jpg
So, I ran another file and kaboom...I get an error..color profile operates on another colorspace. I see the file is a transparent PDF from Illustrator. This file did work previously so that probably why I put those flatten options in.
But, now I can't get any combination to work with this file...
https://dl.dropboxusercontent.com/u/250 ... F_12oz.pdf
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T16:11:38-07:00
by fmw42
That is because your pdf file in already sRGB. Using the CMYK profile tells IM that it is CMYK and then you convert it to sRGB using the second profile. This will definitely mess up your image.
You need to find out what colorspace you have and if any profiles and create a script conditional test to decide what profiles will be needed in your command line to convert your files.
See string formats for %[colorspace] and %[profiles] ( and possibly %[profile:icc] and %[profile:icm]) at
http://www.imagemagick.org/script/escape.php. Also you may want to see if there is an alpha channel if you need to flatten or remove it if you are not use output JPG format. So perhaps also %[channels]. This would also tell you the colorspace.
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T18:54:36-07:00
by broberts
Thank you Fred. I'm an IM noob. I'll get it. Thanks again for the help.
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-26T19:27:22-07:00
by fmw42
You can see all this data by running
So you can see if it is CMYK or sRGB, if there is an alpha, and what profiles it might have. Then you can form your command appropriately to use the correct number and types of profiles.
If you need to do this automatically, then you will need to write a short bat script to do the checking from the string formats above and pick the right pre-prepared command line.
Unfortunately, I work on a Mac (Unix) and do not know Windows scripting.
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-27T07:43:34-07:00
by broberts
Yeah, I did that and I'm getting conflicting results. I ran -verbose on the file I was having issues with (2082_03_R05TFF_12oz.pdf) and IM reports it as sRGB. I check the file in Illustrator...the document mode is CMYK....the blend mode is CMYK and there are no embedded images. I even ran an Acrobat preflight report and it says the colorspace is CMYK. So, I'm not sure how it's being reported as both.
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-27T09:51:36-07:00
by fmw42
You may have a CMYK raster image imbedded in an sRGB PDF shell. I would remove the raster image from the PDF shell to get proper results. See pdfimage, another tool.
EXIFTOOL does not seem to show me any colorspace information. So perhaps it is buried in the xamp profile and Acrobat and Illustrator use information there. IM probably assigned it sRGB, since it found no colorspace information.
To be honest, I don't really know what to tell you.
If I open your file in Acrobat Reader it tells me;
OutputIntent
Identifier: CGATS TR 001
Info: U.S. Web Coated (SWOP) v2
So if you know it is CMYK, then try using the above CMYK profile and then a sRGB profile to convert to rgb. Does that work?
Since the file is grayscale, does it matter?
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-27T11:00:41-07:00
by broberts
Going with the profile throws an error. So, what I did is a strip and then a colorspace. It's not ideal but it's the best setup thus far that will get all files (all tested anyway) going. Rather than using the implementation we used, we're gonna switch over to JMagick which should give us some better control over what's happening via api. That way we can do the evaluations and do the appropriate actions ie. apply a profile or not. Unfortunately, our end users can upload ANY file they want so it's a bit tricky. I really appreciate your help!
Re: problem with conversion from CMYK to sRGB
Posted: 2016-04-27T12:37:07-07:00
by fmw42
There can always be exceptions and bad files. So it may never get every file correct.