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
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