[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-artists
Subject: K-ARTIST: svg to png script
From: Ante Wessels <vitanova2 () softhome ! net>
Date: 2004-01-11 13:31:19
Message-ID: 200401111431.19745.vitanova2 () softhome ! net
[Download RAW message or body]
I wrote a little read me for the svg2png4kde script.
Also, I made a new version of the script, a bit more effective internally. The
behaviour did not change.
Cordialemente,
Ante
******
The most up to date info for kde artists can be found at the wiki:
http://kde.ground.cz/tiki-index.php?page=KDE+Artists
http://home.uwnet.nl/~vita
["svg2png4kde" (application/x-shellscript)]
#!/bin/bash
# script by ante wessels
# vitanova2 --[at]-- softhome --[dot]-- net
# use at own risk
TIMENAME="svg2png$(date +%Y-%m-%d-%H.%M)"
# create dir
mkdir $TIMENAME
DEST1="$TIMENAME"
# copy the files to TIMENAME dir
cp *.svg $DEST1
cp *.svgz $DEST1
# dive into TIMENAME dir
cd $DEST1
# rename the .svgz - if .svg and .svgz have same name .svgz will
# overwrite .svg
rename .svgz .svg.gz *.svgz
# unzip the .svg.gz
for i in *.svg.gz; do gzip -d $i; done
# let sodipodi do the work...
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=16 --export-height=16; done
# these were the 16 x 16, let's give them the proper names
#works, but can be done more effective.
#for i in crsc-*.png; do echo $i > name.txt; sed 's/crsc-/cr16-/g' name.txt > \
newname.txt; mv $i `cat newname.txt`; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr16-/g'`; done
# OK, move the 16 x16 out off the way
mkdir 16x16
mv *.png 16x16
# next step...
# overkill, only the toolbars have to be 22 x 22... ?
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=22 --export-height=22; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr22-/g'`; done
#OK, move the 22 x 22 out off the way
mkdir 22x22
mv *.png 22x22
# next step...
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=32 --export-height=32; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr32-/g'`; done
#OK, move them out off the way
mkdir 32x32
mv *.png 32x32
# next step...
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=48 --export-height=48; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr48-/g'`; done
#OK, move them out off the way
mkdir 48x48
mv *.png 48x48
# next step...
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=64 --export-height=64; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr64-/g'`; done
#OK, move them out off the way
mkdir 64x64
mv *.png 64x64
# next step...
for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=128 --export-height=128; done
for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr128-/g'`; done
#OK, move them out off the way
mkdir 128x128
mv *.png 128x128
echo
date +%H:%M
# next step... a step further; uncomment to see bigger icons
#for i in *.svg; do NAME_NO_EXT=${i%.svg}; sodipodi -z --file=$i \
--export-png=$NAME_NO_EXT.png --export-width=512 --export-height=512; done
#for i in crsc-*.png; do mv $i `echo $i | sed 's/crsc-/cr512-/g'`; done
#mkdir 512x512
#mv *.png 512x512
#echo
#date +%H:%M
["svg2png4kde-read_me.txt" (text/plain)]
Hi everyone!
I made a little script that can render svg and svgz files into png files in the sizes \
16, 22, 32, 48, 64 and 128.
As always, run scripts on copies!, and after taking a look at it. I did put some \
safety in it, the script makes copies itself, and saves to a timestamped dir, so not \
overwriting anything.
Problems:
1 sodipodi can not open some (most) illustrator svgs... It should be very
handy for everyone working with sodipodi though. As sodipodi gets improved the script \
will perform better too! Or may be there is an other rendering machine. (There is one \
in kdelibs/pics/crystalsvg, and there is also a Batik SVG toolkit) 2 solved!
3 If there is a foo.svg and a foo.svgz the foo.svgz will be rendered, not the foo.svg \
This is not a problem, unless the foo.svg is newer. Then remove the foo.svgz first.
You may have to make the script executable again.
***
Ah, I did forget to tell the basic! Make a directory, say "2render", put the svg and \
svgz you want to render in it with the script, cd into the directory. Run \
./svg2png4kde and watch the results. The icons that can not be rendered by Sodipodi \
wil get errors messages. A new dir will be created in your "2render" dir.
***
When you have an icon that follows the crsc-mime-kate.svg naming convention
the 16 png icon will be called cr16-mime-kate.png, the 32 icon
cr32-mime-kate.png, etc, making it easy to commit.
Without a prefix there is nothing to change, nothing will happen. May be
someone is working on his own icon set, he/she does not need cr16- etc.
If you correctly name your icon from the beginning, the results will be ready to send \
in. (I skip the repair phase :-)
***
Easter egg: if you uncomment the last few lines, the script will render 512x512 icons \
too.
_______________________________________________
kde-artists mailing list
kde-artists@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-artists
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic