anpassung für transparente png konvertierung

This commit is contained in:
Eva Möller
2012-08-21 13:43:44 +02:00
parent 8e2f0acb59
commit 76303817a1
3 changed files with 12 additions and 9 deletions
+6 -3
View File
@@ -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) &
+1 -1
View File
@@ -6,6 +6,6 @@ if [ -z $PICCREATE ];then
exit 0
fi
CMD=convert
SECTION_NAME=jpgs
SECTION_NAME=png
. $PICCREATE_BIN/generationlib
+5 -5
View File
@@ -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 '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">'
begintpl = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -34,14 +33,15 @@ def create_picture_frame( config ):
height="${height}"
>
'''
imagetpl = ''' <image width="${width}" height="${height}"
xlink:href="file://${background}">
</image>
'''
svgbegin = Template( begintpl ).substitute(params)
# falls ein Hintergrundbild verwendet werden soll, dann das genauso gross
# machen...
try:
params['background'] = config.get('globals', 'background')
imagetpl = ''' <image width="${width}" height="${height}"
xlink:href="file://${background}">
</image>
'''
background = config.get('globals', 'background')
font_path = os.path.expandvars(os.path.join('$PICCREATE_BACKGROUNDS', background ))
params['background'] = os.path.normpath(font_path)