Page 1 of 1
Background color loss from EPS to other formats
Posted: 2014-01-23T00:44:36-07:00
by Carter J
Hi All,
We have few EPS images and while converting them to any other format say for ex: JPEG the background color is lost and is showing up white.
Attached is one eps image which has a back ground and in the other screenshot we can see after converting it to JPEG the back ground is showing up white
Any insight ?
https://www.dropbox.com/s/mdpcm4jc1wkbx ... psFile.eps
https://www.dropbox.com/s/lbe1b43bo6w1931/EpsToJPG.jpg
Version: ImageMagick 6.8.7-4 2013-10-26
Thanks
Re: Background color loss from EPS to other formats
Posted: 2014-01-23T02:54:25-07:00
by snibgo
If you "identify -verbose SampleEpsFile.eps" you will see it has a clipping path, which IM ignores by default. See
http://www.imagemagick.org/script/comma ... s.php#clip
However, when I try for example "convert SampleEpsFile.eps -clip -negate t.png" I get:
Code: Select all
convert.exe: image size differs `sampleepsfile.eps' @ error/image.c/SetImageClipMask/2398.
Re: Background color loss from EPS to other formats
Posted: 2014-01-28T05:52:19-07:00
by Carter J
Hi snibgo,
Thanks for reply.
I tried
convert SampleEpsFile.eps -clip -negate t.png, and got below image without any warnings or errors.
https://www.dropbox.com/s/de6kjz8x82uxlzr/t.png
Please suggest how can I get desired output without any background color loss.
Thanks,
Re: Background color loss from EPS to other formats
Posted: 2014-01-29T22:31:47-07:00
by Carter J
Guys,
Any workaround on this would be of great help, as we are stuck with this kind of images.
Re: Background color loss from EPS to other formats
Posted: 2014-01-29T23:17:08-07:00
by fmw42
I am not sure what you mean by loss of background. All I see is a bit of aliasing on a white background. Your input eps file also seems to display with a white background. You can remove the aliasing by using supersampling
This does that by a factor of 4 (density 4*72=288 and resize 25%) while converting to sRGB jpg so that viewers do not have trouble with cmyk jpgs.
Code: Select all
convert -density 288 SampleEpsFile.eps -profile /Users/fred/images/Profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/Profiles/sRGB.icc -resize 25% SampleEpsFile2.jpg
If you want more antialiasing try using -density 576 and -resize 12.5%, ie factor of 8 in supersampling. You will have to locate your profiles on your system or download them. But I believe there is a folder in the IM download that has profiles.
Re: Background color loss from EPS to other formats
Posted: 2014-01-29T23:26:44-07:00
by fmw42
Note that jpg does not preserve transparency. So you get a black background, but when it is converted to sRGB it turns white.
Also png does not support cmyk.
This works just fine for me (IM 6.8.8.4 Q16 Mac OSX Snow Leopard with ghostscript 9.06) to keep the transparent background in a png, by converting to sRGB. The best way is to use profiles (and supersampling) as
Code: Select all
convert -density 288 SampleEpsFile.eps -profile /Users/fred/images/Profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/Profiles/sRGB.icc -resize 25% SampleEpsFile2.png
But a quick convert works in this way, though has aliasing artifacts
Code: Select all
convert -colorspace sRGB SampleEpsFile.eps SampleEpsFile3.png
but has aliasing artifacts, so again use supersampling
Code: Select all
convert -colorspace sRGB -density 288 SampleEpsFile.eps -resize 25% SampleEpsFile4.png