kicad/bitmaps_png/icons/mk_icn.sh

68 lines
2.0 KiB
Bash
Raw Normal View History

2011-09-14 18:28:57 +00:00
#!/bin/bash
#
# make icons using Inkscape
2022-01-23 04:32:16 +00:00
# inkscape (1.0.2 minimum) and icotool are necessary
2011-09-14 18:28:57 +00:00
# create output directories
rm -r tmp
rm icon_*.png
mkdir tmp
mkdir tmp/22 tmp/26 tmp/32 tmp/48 tmp/64 tmp/128 tmp/256 tmp/ico
echo "all directories created."
2022-01-23 02:08:01 +00:00
cd ../sources/light
2011-09-14 18:28:57 +00:00
ICON_FILES="icon_3d.svg
icon_gerbview.svg
icon_kicad.svg
2022-01-23 02:08:01 +00:00
icon_kicad_nightly.svg
2011-09-14 18:28:57 +00:00
icon_bitmap2component.svg
icon_pcbcalculator.svg
2022-01-23 02:08:01 +00:00
icon_pagelayout_editor.svg
2011-09-14 18:28:57 +00:00
icon_cvpcb.svg
icon_pcbnew.svg
2020-10-26 10:54:36 +00:00
icon_eeschema.svg
icon_pcm.svg"
2011-09-14 18:28:57 +00:00
# convert .svg files into .png files
for fl in $ICON_FILES
do
NAME=${fl%.*} # strip the file extension
2022-01-23 04:32:16 +00:00
inkscape -o ../../icons/tmp/22/$NAME.png -w 22 -h 22 --export-area-snap $fl
inkscape -o ../../icons/tmp/26/$NAME.png -w 26 -h 26 --export-area-snap $fl
inkscape -o ../../icons/tmp/32/$NAME.png -w 32 -h 32 --export-area-snap $fl
inkscape -o ../../icons/tmp/48/$NAME.png -w 48 -h 48 --export-area-snap $fl
inkscape -o ../../icons/tmp/64/$NAME.png -w 64 -h 64 --export-area-snap $fl
inkscape -o ../../icons/tmp/128/$NAME.png -w 128 -h 128 --export-area-snap $fl
inkscape -o ../../icons/tmp/256/$NAME.png -w 256 -h 256 --export-area-snap $fl
2011-09-14 18:28:57 +00:00
echo "file $fl converted."
done
# convert .png files into .ico files using "icotool" from icoutils
# (see http://www.nongnu.org/icoutils/)
2022-01-23 02:08:01 +00:00
cd ../../icons
2011-09-14 18:28:57 +00:00
for fl in $ICON_FILES
do
NAME=${fl%.*} # strip the file extension
icotool -c tmp/22/$NAME.png tmp/26/$NAME.png tmp/32/$NAME.png tmp/48/$NAME.png \
tmp/64/$NAME.png tmp/128/$NAME.png -o tmp/ico/$NAME.ico
2011-09-14 18:28:57 +00:00
echo "file $fl converted in .ico file."
done
# make mosaic images locally
montage tmp/64/*.png -geometry +6+6 -tile x1 all.png
echo "mosaic images created"
# create png and xpm 64 px from icon_kicad
cp tmp/64/icon_kicad.png ./icon_kicad_64.png
convert icon_kicad_64.png icon_kicad_64.xpm
# create png and xpm 128 px from icon_kicad
cp tmp/128/icon_kicad.png ./
2011-09-14 18:28:57 +00:00
convert icon_kicad.png icon_kicad.xpm
# delete what is not needed
cp tmp/ico/* ./
rm -R tmp