From 76303817a1faad2a77a2dc5d8365d45b32fb9e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20M=C3=B6ller?= Date: Tue, 21 Aug 2012 13:43:44 +0200 Subject: [PATCH] =?UTF-8?q?anpassung=20f=C3=BCr=20transparente=20png=20kon?= =?UTF-8?q?vertierung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/generationlib | 9 ++++++--- bin/svgconvert.sh | 2 +- libs/piccreate.py | 10 +++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/generationlib b/bin/generationlib index caf57fe..bcbae2d 100755 --- a/bin/generationlib +++ b/bin/generationlib @@ -88,8 +88,9 @@ fi CHECKFILE=0 SLEEPTIME=0.5 +BACKGROUND='' -while getopts "j:i:kc:s:o:hc:" OPT; do # "j:" waits for an argument "h" doesnt +while getopts "j:i:kc:s:o:hc:bc" OPT; do # "j:" waits for an argument "h" doesnt case $OPT in h) echo "$USAGE" exit 0 ;; @@ -98,6 +99,7 @@ while getopts "j:i:kc:s:o:hc:" OPT; do # "j:" waits for an argument "h" doesnt c) CFG_FILENAME=$OPTARG ;; o) OUTDIR=$OPTARG ;; s) SLEEPTIME=$OPTARG ;; + b) BACKGROUND='-background transparent ';; i) INPUT_FILENAME=$OPTARG ;; *) echo "$USAGE" >&2; exit 1; # Default. esac @@ -113,15 +115,16 @@ echo $INPUT_FILE for i in `ls $INPUT_FILE| grep .svg ` do ID=`echo "$i" | sed -e 's/;.*//g'` - PIC_NAME=`echo "$i" | sed -e 's/.svg/.jpg/g'` + PIC_NAME=`echo "$i" | sed -e 's/.svg//g'` FILE_PATH=$INPUT_FILE/$PIC_NAME if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ] then echo $PIC_NAME exists else RESIZE="${width}x${height}" - SWITCHES="-density $density $INPUT_FILE/$ID -resize $RESIZE $INPUT_FILE/$PIC_NAME" + SWITCHES="-density $density $BACKGROUND$INPUT_FILE/$ID -resize $RESIZE $INPUT_FILE/$PIC_NAME.$format" CMDLINE="$CMD $SWITCHES" + echo $CMDLINE (echo $ID; $CMDLINE) & diff --git a/bin/svgconvert.sh b/bin/svgconvert.sh index 95e09ed..d69a097 100755 --- a/bin/svgconvert.sh +++ b/bin/svgconvert.sh @@ -6,6 +6,6 @@ if [ -z $PICCREATE ];then exit 0 fi CMD=convert -SECTION_NAME=jpgs +SECTION_NAME=png . $PICCREATE_BIN/generationlib diff --git a/libs/piccreate.py b/libs/piccreate.py index b446971..5968379 100644 --- a/libs/piccreate.py +++ b/libs/piccreate.py @@ -21,7 +21,6 @@ def create_picture_frame( config ): params = dict() params['width'] = config.get('globals', 'width') params['height'] = config.get('globals', 'height') - params['background'] = config.get('globals', 'background') #echo '' begintpl = ''' @@ -34,14 +33,15 @@ def create_picture_frame( config ): height="${height}" > ''' - imagetpl = ''' - - ''' svgbegin = Template( begintpl ).substitute(params) # falls ein Hintergrundbild verwendet werden soll, dann das genauso gross # machen... try: + params['background'] = config.get('globals', 'background') + imagetpl = ''' + + ''' background = config.get('globals', 'background') font_path = os.path.expandvars(os.path.join('$PICCREATE_BACKGROUNDS', background )) params['background'] = os.path.normpath(font_path)