[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-artists
Subject:    K-ARTIST: svg 2 png rendering script
From:       Ante Wessels <vitanova2 () softhome ! net>
Date:       2004-01-09 17:02:24
Message-ID: 200401091750.56255.vitanova2 () softhome ! net
[Download RAW message or body]

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.
2 I did not manage to rename the resulting files properly, see the comments in 
the file. Anyone with the slightest regex experience will do better!
3 If .svg and .svgz have same name .svgz will overwrite .svg

You may have to make the script executable again. 

Try it out! 

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@softhome.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 name, if possible
#for i in *png; do rename=$i; $rename='s/crsc/cr16/'; rename $i $rename; done
# I try to rename the 'crsc' part in the filename to 'cr16' , but do not succeed...

#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

#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

#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

#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

#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

#OK, move them out off the way

mkdir 128x128
mv *.png 128x128

echo
date +%H:%M



_______________________________________________
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