I have 5000 vector images (mostly eps / svg) that i need to convert to PNG with transparent backgrounds. PNG images need to be maximum 4000x4000px

Any idea what would be the best way to do this ? Most batch image converters won't support transparency and resizing.

The first part of the task (vector to PNG) could be done using illustrator or photoshop actions, but i haven't found a way to set max size at 4000x4000 while keeping aspect ratio and maximum resolution matching the requirements

One option could be to split the task and run the PNG through something else to resize them to maximum 4000x4000px... Maybe Inkscape ? I saw some people were able to write python scripts to do similar tasks

the problem is that it's hard to set the 4000x4000px limit

1 Answer 1


That would be a job for the command line tool Image Magick mogrify. The following command:

mogrify -resize '4000x4000' -format png *.svg

Will convert all SVG files in the current folder to PNG keeping the aspect ratio but with the largest side exactly 4000 pixels.

In case we had defined a non-transparent white (or any other color) background in the source SVG we can add transparency with:

mogrify -resize '4000x4000' -transparent white -format png *.svg

Note on Windows command line:
We need to prefix the commands with magick and should not use ticks ' but nothing, or quote marks " instead.

An example Windows command may look like this:

magick mogrify -resize "4000x4000" -transparent white -format png *.svg

Converting EPS files need a density value (in DPI) in addition:

magick mogrify -resize "4000x4000" -density 300 -transparent white -format png *.eps
  • I'm totally noob could you link to some documentation about the usage of ImageMagick with windows ? i did read the docs on the official website, i did exactlty what they suggested, installed ImageMagick for Windows and tried to run your commands through a CMD prompt or WindowsPowershell but it always say "the command mogrify is not recognized".... What am i missing ?
    – user56740
    Commented Dec 10, 2016 at 19:24
  • Convert command seems recognized but i get an error about the parameter 4000x4000 gyazo.com/e9a8e86909ae9514ba7ffa152aff4b87 .... The install path of ImageMagick is default Programs folder, but searching for "morgrify" inside that folder doesn't return any executable file gyazo.com/45572dbacc8ecae2b990063f40f92757 .... I just installed default ImageMagick for windows, did i need anything else ? Thanks!
    – user56740
    Commented Dec 10, 2016 at 20:34
  • It's working !!!! Thank you so much ! You just saved me DAYS of work !
    – user56740
    Commented Dec 10, 2016 at 20:53
  • When testing this command with EPS instead of *.svg i get a weird error : gyazo.com/7d4ecc904702e94f0d813588f7bdd45c
    – user56740
    Commented Dec 10, 2016 at 23:43
  • The output result of the EPS file looks like this : gyazo.com/0d2d313b73d669ef0c92eca9855c23e5 If i open the same image in illustrator and convert it to SVG instead, save it in the exact same folder, then run the script with *.svg parameter the output PNG looks good and there is no error... So it doesn't look like a path error, or an error with the graphic file... SVG are converted correctly, but not EPS :(
    – user56740
    Commented Dec 10, 2016 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.