EN
Bash - batch export from svg to properly sized png file (squared web page icon in pixels: 48 72 96 144 192 256 384 512)
2
points
In this short article we are going to look at how quickly and in autmated way, export some svg file to png icon with Bash and Inkscape.
Note: check that you have installed Inkscape:
- https://inkscape.org/release/inkscape-1.0/
- or
apt-get install inkscape
for Debian
Do following steps:
1. Create export.sh
file:
#!/bin/bash
icon="icon.svg" # input icon
program="inkscape" # for linux
#program="/C/Program Files/Inkscape/inkscape.exe" # for windows x64
for i in 48 72 96 144 192 256 384 512;
do
"${program}" -z -e "./icon-${i}x${i}.png" -w "${i}" -h "${i}" "${icon}";
done
2. Add permissions for script if it is necessary:
chmod +x export.sh
3. Run export.sh
:
./export.sh
4. Result:
You should see in same directory png files.
Note: do not forget to use squared svg icon.
