Last active
September 9, 2022 07:39
-
-
Save FKasa/a832cf34be5b44eeb0d64ca7e84ff510 to your computer and use it in GitHub Desktop.
Use inkscape to generate images in multiples sizes in one go using CLI (through Git's Bash for windows)
This file contains hidden or 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
#Remove -w or -h if file is not square. | |
for i in {16,64,128,256,512,1024,2048,1080,2160}; do /c/Program\ Files/Inkscape/inkscape.exe -z -e image$i.png -w $i -h $i ./vector.svg; done | |
for i in {16,64,128,150,256,512,1080,2160}; do /c/Program\ Files/Inkscape/bin/inkscape.exe --export-filename=image$i.png -w $i -h $i ./vector.svg; done | |
#!/bin/bash | |
mkdir "$PWD"/pdf | |
for file in $PWD/*.svg | |
do | |
filename=$(basename "$file") | |
inkscape "$file" --export-type=pdf --export-filename="$PWD"/pdf/"${filename%}.pdf" | |
done | |
logoname=$(echo logo*.svg); echo ${logoname[0]}; for i in {16,64,128,150,256,512,1080,2160}; do /c/Program\ Files/Inkscape/bin/inkscape.exe --export-filename="${logoname[0]}_$i.png" -w $i ./$logoname; done | |
Windows: | |
@echo off | |
for %%i in ("%~dp0*.svg") do ( | |
echo %%i to %%~ni.png | |
"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" "%%i" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment