Page 1 of 1
AI to PNG Transparency
Posted: 2007-12-31T12:57:29-07:00
by Acestes
I had a problem with getting EPS files to convert to PNG files (see
here) while maintaining their transparency. I'd just like to say that AI (Adobe Illustrator CS2) files also fail to maintain their transparency when converted to PNG. I've tried the '-colorspace rgb' addition that was mentioned to temporarily fix the EPS bug but unfortunately it didn't seem to work. It's not a major problem as I don't actually need to convert the AI files, but I thought it was worth mentioning in case someone does!
Re: AI to PNG Transparency
Posted: 2007-12-31T15:21:20-07:00
by magick
Post a URL to one or two AI images so we can download and reproduce the problem. Thanks.
Re: AI to PNG Transparency
Posted: 2008-01-01T06:47:29-07:00
by Acestes
Sorry I meant to post links to example files and forgot.
Here they are
Adobe Illustrator CS
Adobe Illustrator CS2
Adobe Illustrator CS3
Re: AI to PNG Transparency
Posted: 2008-01-01T08:41:27-07:00
by magick
ImageMagick utilizes the Ghostscript delegate to render Postscript and PDF. The Ghostscript pngalpha device supports transparency but for only one page. Since there is no easy way to determine if a PDF is only one page we use the pnmraw device instead which does not support transparency. Until Ghostscript provides a multi-page device that supports transparency the only solution is to edit delegates.xml and change the ps:color delegate from pnmraw to pngalpha or use the Ghostscript application directly.
Re: AI to PNG Transparency
Posted: 2008-01-01T09:01:07-07:00
by Acestes
Thank you for the relpy. Changing the XML does fix the problem
Interestingly I have had a look and Adobe Illustrator doesn't actually support multi-page, so if you did want to convert ai files the change wouldn't have a negative impact. Or at least it wouldn't as long as you didn't want to convert a multi-page document (would that be from a PDF? I can't think of anything else that is multi-page.). I presusme that if you used this all the time then a multi-page document would have it's first page made transparent and then the rest white?
Re: AI to PNG Transparency
Posted: 2008-01-01T10:06:29-07:00
by magick
We have a patch in ImageMagick 6.3.7-9 Beta (available sometime tomorrow) that will display AI images as transparent but only if its explicitly specified as follows:
Re: AI to PNG Transparency
Posted: 2008-01-01T12:08:15-07:00
by Acestes
Excellent
Will it be just the display for now or will it work with convert as well? I take it the program can't be made to recognise the AI images automatically? Do you happen to know if this new patch will also fix the transparency problem with EPS files saved in Imageformat version 2 (as mentioned in
this thread)
Re: AI to PNG Transparency
Posted: 2008-01-01T13:13:49-07:00
by magick
The problem is EPS is the language level. When we checked the specification, transparency was not supported until Level 3. Its possible the language level was not properly reported for the thread you mentioned or we got it wrong. Either way, transparent EPS should render properly with the latest ImageMagick release (assuming your version of Ghostscript supports the pngalpha device).
Re: AI to PNG Transparency
Posted: 2008-01-02T05:33:28-07:00
by Acestes
Thanks for the info. I have also looked up the specification and like you said only Level 3 supports transparency. Apparently Adobe Illustrator and other programs 'fake' the background transparency in the EPS files, which is why it 'appears' that a Level 2 EPS has a transparent background. I was wondering if there was a 'command' that I could use that would make the white background transparent (as white is not used in any of my images since the printer doesn't understand 'white' ink :lol). I tried to use -transparent white, but it doesn't work unless I save the EPS to the PNG and then re-run the command on the PNG.
Re: AI to PNG Transparency
Posted: 2008-01-02T07:19:12-07:00
by magick
This works for us (using ImageMagick 6.3.7-8):
- convert logo: logo.eps
convert -colorspace rgb logo.eps -transparent white logo.png
Re: AI to PNG Transparency
Posted: 2008-01-02T07:30:53-07:00
by Acestes
Well I don't believe it! I tried that and it wouldn't work, but now it does! I think it's time for a bit of clean up as I'm probably getting versions confused again. Sorry to have been a pain
All the best and keep up the good work
Re: AI to PNG Transparency
Posted: 2008-01-02T17:40:46-07:00
by anthony
magick wrote:This works for us (using ImageMagick 6.3.7-8):
- convert logo: logo.eps
convert -colorspace rgb logo.eps -transparent white logo.png
Be careful, that just replaces any pure white pixels with transparency. It will probably have the side effect of leaving white halos around text and lines.
For alternatives see IM Examples, Text Handling, Postscript.
http://imagemagick.org/Usage/text/#postscript
Re: AI to PNG Transparency
Posted: 2008-01-03T04:39:47-07:00
by Acestes
anthony wrote:magick wrote:This works for us (using ImageMagick 6.3.7-8):
- convert logo: logo.eps
convert -colorspace rgb logo.eps -transparent white logo.png
Be careful, that just replaces any pure white pixels with transparency. It will probably have the side effect of leaving white halos around text and lines.
For alternatives see IM Examples, Text Handling, Postscript.
http://imagemagick.org/Usage/text/#postscript
Thanks for the 'halo' info Anthony
It shouldn't be a problem in my particular case as I'm taking images that are a minimum of 1000px (wide), doing the required conversions and then reducing them to around 100px (wide) max for preview purposes.