Last active
November 5, 2022 19:40
-
-
Save loganpowell/5ba8232145081cde94d65f20ee6cb0f1 to your computer and use it in GitHub Desktop.
batch process all svg files in containing folder with scour (Windows `.bat` file)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Echo off | |
setlocal ENABLEDELAYEDEXPANSION | |
echo. | |
echo This script runs through all the .svg files in the folder within which this file is contained and outputs an optimized version to the 'out' folder here... | |
:: echo (type q to quit at any question) | |
echo. | |
:: count how many files we need to convert before converting! | |
set /a total=0 | |
for /R %%i in (*.svg) do ( | |
if not exist %%~di%%~piout mkdir %%~di%%~piout | |
set /a total=total+1 | |
) | |
echo Conversion started. Will do %total% file(s). | |
echo. | |
for /R %%i in (*.svg) do ( | |
set /a count=count+1 | |
echo. | |
echo %%i -^> %%~di%%~piout\%%~ni.%outputType% ^[!count!/%total%^] | |
echo %%~ni | |
echo. | |
:: requires python package: https://github.com/scour-project/scour | |
scour -i %%~ni.svg -o %%~di%%~piout\%%~ni.svg --enable-viewboxing --enable-id-stripping --enable-comment-stripping --shorten-ids --indent=none | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
used for reducing the file size of layers exported from Inkscape's File > Save As > Layers as Separate SVG