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
you don't need shell scripting just use the mogrify
command
cd to your image directory
mogrify -format png *.svg
Try with a FOR
loop with /R
flag from inside your root folder:
FOR /R %a IN (*.svg) DO convert "%~a" "%~dpna.jpg"
this command will convert all the .svg
files in your sub-directories under the root folder you launched your command from.
Above command works for command line, if you plan to use the command inside a batch file (.bat) remember to use %%
instead of %
:
FOR /R %%a IN (*.svg) DO convert "%%~a" "%%~dpna.jpg"
See this page of Imagemagick documentation for more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With