Aller au contenu

Convertir fichier SVG en ICO

Modules requis#

Bash
apt install inkscape
apt install imagemagick

Variables#

Bash
SVGFILE=img_source.svg
ICOFILE=favicon.ico

Convertir SVG en 3 PNG de tailles standards#

Bash
1
2
3
inkscape --without-gui -w 16 -h 16 --export-png=16.png $SVGFILE
inkscape --without-gui -w 32 -h 32 --export-png=32.png $SVGFILE
inkscape --without-gui -w 96 -h 96 --export-png=96.png $SVGFILE

Convertir les PNG dans un fichier ICO#

Bash
convert 16.png 32.png 96.png $ICOFILE

Autre commande utilse#

Bash
1
2
3
4
5
# Crop
convert a_logo.png -crop 334x334 334.png

# resize
convert 334.png -resize 32x32 32.png

Pour valider le contenu#

Bash
identify $ICOFILE