Languages
[Edit]
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
Created by:
Root-ssh
75700

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

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:
YÔÇőÔÇőÔÇőÔÇőÔÇőou should see in same directory png files.

Note: do not forget to use squared svg icon. 

 

Svg icon exported to png files with Inkscape in Bash
Svg icon exported to png files with Inkscape in Bash
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - friendly IT community for everyone.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join