How can I convert svg images to png with transparent background. I have almost 4000 svg images to covert. I tried to use many converter but they can't supply transparent background. i saw imagemagick . But how can I use this to convert all of my images at the same time. What can i do now.
Asked
Active
Viewed 1.3k times
7

Mark Setchell
- 191,897
- 31
- 273
- 432

Faisal Ahmed
- 91
- 1
- 1
- 5
-
1See ImageMagick's "mogrify" command which operates on multiple images. But you need to rephrase this question so it's clearly about programming. – Glenn Randers-Pehrson Jul 12 '15 at 13:07
-
You might mention whether you are on OS X, Linux or Windows - it makes a big difference. – Mark Setchell Jul 13 '15 at 07:34
2 Answers
19
Use ImageMagick
like this:
mogrify -background none -format png *.svg
that says... "take all the SVG
files and render them as PNG
files with a transparent background."
ImageMagick is available from here. It is installed on most Linux distros and is available for OSX (ideally via homebrew
) and also for Windows.
It's possible that will not work, if your SVG files are defined using, say, a rectangle of white as the background rather than defining a background properly in SVG terms. If there are files that don't work, please post them, so they can be checked.
If you are on Linux, you can use GNU Parallel
to speed this up for thousands of files, but you didn't say.

Mark Setchell
- 191,897
- 31
- 273
- 432
-
Could not find anything similar for windows, no "mogrify" executable in the installed package, and since I am not familiar with the package itself this took me some googling to figure out. (I need converting images once in a blue moon.) So the correct full command line should be the following: >magick mogrify -background none -format png *.svg – Peter Bulyaki Sep 14 '17 at 13:52
-
2@PeterBulyaki Yes, the command names changed with ImageMagick v7 last year. If you had wanted to continue to use the *"old"* names, you would have had to tick the option *"Install legacy names"* when installing. Sorry, I haven't got around to updating all my old answers. – Mark Setchell Sep 14 '17 at 15:10
0
If you are using Windows, you can use IrfanView (http://www.irfanview.com/).
- Go to File -> Batch Conversion/Rename
- Select Batch Conversion
- Choose your output format (PNG) and click the 'options' button to set your transparancy requirements. You can choose to use the main window color as transparent color, otherwise you will be prompted to select the transparent color in a preview of the image for every image...
- Don't forget to set your output folder and to select the files to convert
- Press 'Start Batch'

Roelant
- 47
- 3