Search code examples
imagemagickimage-manipulationgraphicsmagick

How to keep transparent background in GraphicsMagick .ai to .png conversion?


I'm using a GraphicsMagick package for image processing

When converting Illustrator (.ai) files to .png files, I end up losing transparency so the background ends up white.

I don't have this problem when using the same options and converting with ImageMagick, but I need a solution to make it work with GraphicsMagick specifically.


Solution

  • I don't have much experience with GraphicsMagick, but I would assume that the behavior of -background is the same as ImageMagick's:

    gm convert -background transparent source.ai out.png
    

    Note: This works by defining the background before reading the vector graphic