EPS images - preserve transparent background

Problem

EPS/AI assets might have transparert background which is not being preserved when converting to formats supporting transparency (e.g. PNG format).

Cause

Asset Bank uses Ghostscript (via ImageMagick) to convert EPS and AI images to different formats. By default Ghostscript converts them using a "device" which does not support alpha channel on conversion.

Solution

Amend ImageMagick configuration on the Asset Bank server in order to make GhostScript convert using a "device" that supports alpha channel.

First locate the path of the delegates.xml file for your ImageMagick installation.

On Windows

The file can be found inside the ImageMagick installation folder, i.e.:

C:\Program Files\ImageMagick\delegates.xml

On Unix

Run the following and look for the CONFIGURE_PATH path in the first lines of the resulting output:

$ convert -list configure

This will give you the directory that contains delegates.xml. eg:

CONFIGURE_PATH /usr/local/etc/ImageMagick-6/

Amend 'delegates.xml'

Edit delegates.xml with your favourite editor and locate the following line:

<delegate decode="ps:cmyk" stealth="True" command="&quot;/opt/local/bin/gsx&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pamcmyk32&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>

replace pamcmyk32 with pngalpha so that the resulting line would be:

<delegate decode="ps:cmyk" stealth="True" command="&quot;/opt/local/bin/gsx&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pngalpha&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>

NOTE: this solution is aimed at fixing CMYK EPS images, if you are having the same issue with RBG EPS/AI image apply the same change on another PostScript decode line marked with decode="ps:color".


Was this article helpful?

Yes No

Thanks for your feedback!