Converting EPS to transparent GIF part 3

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

If ghostscript had one robust device to handle RGB, RGBA, CMYK, and CMYKA image types (RGB and CMYK with and without transparency) ImageMagick would be able to render Postscript to an image format quite robustly. However, ImageMagick has to select from different devices based on what it sees in the Postscript document. It chooses the device conservatively to ensure the conversion is proper for a great majority of Postscript documents. The devices available include a monochrome device, a RGB device, a RGBA device, and a CMYK device. Given that, to fix this problem you need a Ghostscript version that supports the RGBA device (pngalpha) at the time ImageMagick is built. Type
  • gs -h
and look for pngalpha. Also ensure this device is specified in the ImageMagick delegates.xml file:
  • <delegate decode="ps:alpha" stealth="True" command='"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-g%s" "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s"' />
Next, ImageMagick requires the LanguageLevel DCS comment in the Postscript file. We added
  • %%LanguageLevel: 3
to clipart2.eps and it converted as expected (a man with a camera with a transparent background):
  • convert -colorspace rgb clipart2.eps clipart.gif
Another solution is to change all references of pnmraw to pngalpha in
  • /usr/local/lib/ImageMagick-6.2.9/config/delegates.xml
Post Reply