Convert from eps with transparent background to png
Convert from eps with transparent background to png
Hi All,
this is my first post on this forum, even if I am using imagemagick since quite 5 years ago.
I need to convert a vectorial image (eps) to png format and a found that eps image format is supported by imagemagick.
But if I try to convert an eps image with a transparent background, I found that the resulting png image has a white background instead of a transparent one as expected.
I looked for this problem along your forum and I found no post about, and every convert option about background color has not effect on my resulting images.
The convert command I am using is the following (simple) one:
/usr/bin/convert dial_example.eps step0.png
Does anyone know how to make convert keep the original transparent background on the resulting image?
Thanks a lot to everyone
Valerio
this is my first post on this forum, even if I am using imagemagick since quite 5 years ago.
I need to convert a vectorial image (eps) to png format and a found that eps image format is supported by imagemagick.
But if I try to convert an eps image with a transparent background, I found that the resulting png image has a white background instead of a transparent one as expected.
I looked for this problem along your forum and I found no post about, and every convert option about background color has not effect on my resulting images.
The convert command I am using is the following (simple) one:
/usr/bin/convert dial_example.eps step0.png
Does anyone know how to make convert keep the original transparent background on the resulting image?
Thanks a lot to everyone
Valerio
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert from eps with transparent background to png
this works for me with a transparent eps that is cmyk
convert -colorspace rgb test.eps test.png
what version of IM are you using? if old, perhaps upgrade.
also you could post a link to your image and others could test it.
convert -colorspace rgb test.eps test.png
what version of IM are you using? if old, perhaps upgrade.
also you could post a link to your image and others could test it.
Re: Convert from eps with transparent background to png
Hi fmw42,
thank you very much, it works fine!
So if I understood well, if a transparent eps cmyk, I have to set colorspace to rgb to mantain its transparent background.
How can I understand the image colorspace before converting it?
Another question: I am trying also to convert a vectorial ".ai" image, which is rgb, but I can't get a transparent background even using different colorspace.
Following the links to eps and ai test vector images I am using
http://mithrandir77.homelinux.net/vecto ... example.ai
http://mithrandir77.homelinux.net/vecto ... xample.eps
Thanks a lot for your help
Valerio
thank you very much, it works fine!
So if I understood well, if a transparent eps cmyk, I have to set colorspace to rgb to mantain its transparent background.
How can I understand the image colorspace before converting it?
Another question: I am trying also to convert a vectorial ".ai" image, which is rgb, but I can't get a transparent background even using different colorspace.
Following the links to eps and ai test vector images I am using
http://mithrandir77.homelinux.net/vecto ... example.ai
http://mithrandir77.homelinux.net/vecto ... xample.eps
Thanks a lot for your help
Valerio
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert from eps with transparent background to png
I don't really know too much about vector formats. I am told you can change the device in the delegates.xml file so that you don't need to change to rgb. But I don't know what is needed. Perhaps one of the IM folks can clarify further.
Re: Convert from eps with transparent background to png
I am struggling with this myself for a while...
The "-colorspace RGB" parameter will give you transparency with EPS files, yes.
As fmw42 said, you have to edit the delegates.xml to get transparency with PDF files, too. You need to edit the line '<delegate decode="ps:color"...'. There you have to change '-sDEVICE=pnmraw' to '-sDEVICE=pngalpha'. If you edit the line '<delegate decode="ps:cmyk"...' the same way, you also don't have to use "-colorspace RGB" anymore. (Another possibility would be to create a new delegate for this.)
Now if you have multi-page PDFs, with "pngalpha" you will only get an output for the first page. That's the only disadvantage AFAIK.
If the main goal is to get the alpha layer, this will probably suffice.
But a small warning: If you also need correct colors (when you have real CMYK colors in the input files), this won't suffice. Getting correct colors AND transparency with ghostscript (with one command), that's nearly impossible. At least I don't know an easy solution.
The "-colorspace RGB" parameter will give you transparency with EPS files, yes.
As fmw42 said, you have to edit the delegates.xml to get transparency with PDF files, too. You need to edit the line '<delegate decode="ps:color"...'. There you have to change '-sDEVICE=pnmraw' to '-sDEVICE=pngalpha'. If you edit the line '<delegate decode="ps:cmyk"...' the same way, you also don't have to use "-colorspace RGB" anymore. (Another possibility would be to create a new delegate for this.)
Now if you have multi-page PDFs, with "pngalpha" you will only get an output for the first page. That's the only disadvantage AFAIK.
If the main goal is to get the alpha layer, this will probably suffice.
But a small warning: If you also need correct colors (when you have real CMYK colors in the input files), this won't suffice. Getting correct colors AND transparency with ghostscript (with one command), that's nearly impossible. At least I don't know an easy solution.
Re: Convert from eps with transparent background to png
Thanks a lot both for your help.
First, I understood that my knowledge about image formats and conversion is very little at the moment
However, I can't modify delegates.xml config file, because the service I am developing will be hosted on an external hosting service.
So I think that I have to limit my service to convert a single eps image in png format.
Thanks a lot again for your suggestions, I keep these in mind going on investigating
First, I understood that my knowledge about image formats and conversion is very little at the moment
However, I can't modify delegates.xml config file, because the service I am developing will be hosted on an external hosting service.
So I think that I have to limit my service to convert a single eps image in png format.
Thanks a lot again for your suggestions, I keep these in mind going on investigating
Re: Convert from eps with transparent background to png
If you want to try it with PDFs/AIs eventually and you can't alter the delegates of ImageMagick, you can probably execute a Ghostscript command (instead of executing an ImageMagick command which will itself execute Ghostscript). As a starting point, you could use something like this:
gs -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dUseCIEColor -r72x72 -sOUTPUTFILE=output.png input.ai
(The '-dUseCIEColor' parameter is good for CMYK files. You won't always get perfect colors - but at least transparency. )
gs -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dUseCIEColor -r72x72 -sOUTPUTFILE=output.png input.ai
(The '-dUseCIEColor' parameter is good for CMYK files. You won't always get perfect colors - but at least transparency. )
Re: Convert from eps with transparent background to png
Drarakel wrote:If you want to try it with PDFs/AIs eventually and you can't alter the delegates of ImageMagick, you can probably execute a Ghostscript command (instead of executing an ImageMagick command which will itself execute Ghostscript). As a starting point, you could use something like this:
gs -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dUseCIEColor -r72x72 -sOUTPUTFILE=output.png input.ai
(The '-dUseCIEColor' parameter is good for CMYK files. You won't always get perfect colors - but at least transparency. )
Good, I will try
I will keep you updated about
Re: Convert from eps with transparent background to png
Hi ,
I am able to convert my EPS to PNG with white text on it . I have set colorspace to RGB . But I am getting one issue, I am getting some blackoutline on white text after converting to png.
If anybody is having some solution please suggest.
I am able to convert my EPS to PNG with white text on it . I have set colorspace to RGB . But I am getting one issue, I am getting some blackoutline on white text after converting to png.
If anybody is having some solution please suggest.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert from eps with transparent background to png
What version of IM and Ghostscript? If either are old, try an upgrade.
Otherwise, please post sample inputs and outputs. You can upload to somewhere like dropbox.com and paste the URLs here.
Otherwise, please post sample inputs and outputs. You can upload to somewhere like dropbox.com and paste the URLs here.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert from eps with transparent background to png
For current versions of IM use -colorspace sRGB not -colorspace RGB.
Please post your exact command line.
In the future, please do not tack onto an old post. Please start a new one with your exact problem.
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
For novices, see
viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Please post your exact command line.
In the future, please do not tack onto an old post. Please start a new one with your exact problem.
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620
For novices, see
viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/