views:

44

answers:

2

Hello.

There's a need to transform .svg files and save em either in .svg or jpeg format. The problems with ImageMagick is that it saves transformed files on white background and I deadly need it on transparent.

Any suggestions with other tools or clear php? Would really appreciate it.

+1  A: 

The right image magick command should be:

convert -background none somefile.svg somefile.png

You should use png or gif as file format, because jpg doesn't support transparency

to use it in PHP:

<?php
$svg_file_name = "somefile.svg";
$png_file_name = "somefile.png;
system("convert -background none $svg_file_name $png_file_name");
?>
jigfox
i need some php tools of imagemagick - not external command
Monky
you said "Any suggestions with other tools or clear php", so it was with some other tool! But you can call this from within PHP, see my updated answer.
jigfox
A: 

I doubt you can transform SVG files easily from within php. SVG files are basically XML files, and the standard is public, so anyone can make a converter...

I'd go for the external tool, it's easier and faster than processing from within a scripted language, and a lot safer when the author of the script dosen't actually know how to find out the command line switches for an application, and that JPEG files does not support transparency:)

go for convert -background none somefile.svg somefile.png as Jens said...

Quamis