2

I try to convert SVG to PNG. Result picture has a white background I need transparent.

Sample of code:

wand = NewMagickWand()
MagickReadImage(wand,tmp_file_name)
transparentColor = NewPixelWand()
PixelSetMagickColor(transparentColor, 'none')
MagickSetBackgroundColor(wand, transparentColor)
MagickWriteImage(wand,new_filename)

if I do in command-line:

convert -background 'transparent' ./media/2222222.svg ./media/2222222.png

I've got a transparent picture.

mapcuk
  • 800
  • 1
  • 7
  • 21

1 Answers1

3

I used subprocess and I got what I want

args = ['convert', '-background', 'transparent', './media/2222222.svg', './media/2222222.png',]
result = subprocess.call(args)
mapcuk
  • 800
  • 1
  • 7
  • 21
  • @macpuk: Can you provide more code on how you implemented the subprocess? Did you use `MagickCommandGenesis()`? – gotnull Sep 21 '11 at 05:07