Top community members
All Wiki Articles Create Wiki Article

Welcome to Dirask IT community! ❤ 💻
We are community of people that helps each other.

If you are beginner in IT field, you are more then welcome to ask questions, it will help you to learn faster. We are here to help you.

We are always beginner in something, we just need to remember it along the way.

there are no wrong questions - Ask Question

Bash - batch export from svg to properly sized png file (squared web page icon in pixels: 48 72 96 144 192 256 384 512)

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

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more