Batch command for ImageMagick to convert all files in a directory and sub-directories on windows

Key picture Key · May 23, 2015 · Viewed 19.5k times · Source

I have thousands of SVG's in a folder and sub-folders. What I want is to batch convert all of them to jpg or png images.

Can someone help me write a command for ImageMagick (windows), which can find and convert all the svg's to jpg/png with their original names and keep them in the same directories?

Here is the example structure:

C:\SVG\BusinessMan.svg
C:\SVG\Models\Home.svg
C:\SVG\Underlines\underline.svg

And I want it like this after conversion:

C:\SVG\BusinessMan.svg
C:\SVG\BusinessMan.jpg
C:\SVG\Models\Home.svg
C:\SVG\Models\Home.jpg
C:\SVG\Underlines\underline.svg
C:\SVG\Underlines\underline.jpg

Answer

temi007 picture temi007 · Jan 24, 2020

you don't need shell scripting just use the mogrify command

cd to your image directory

mogrify -format png *.svg