anpassung für transparente png konvertierung
This commit is contained in:
+6
-3
@@ -88,8 +88,9 @@ fi
|
|||||||
|
|
||||||
CHECKFILE=0
|
CHECKFILE=0
|
||||||
SLEEPTIME=0.5
|
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
|
case $OPT in
|
||||||
h) echo "$USAGE"
|
h) echo "$USAGE"
|
||||||
exit 0 ;;
|
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 ;;
|
c) CFG_FILENAME=$OPTARG ;;
|
||||||
o) OUTDIR=$OPTARG ;;
|
o) OUTDIR=$OPTARG ;;
|
||||||
s) SLEEPTIME=$OPTARG ;;
|
s) SLEEPTIME=$OPTARG ;;
|
||||||
|
b) BACKGROUND='-background transparent ';;
|
||||||
i) INPUT_FILENAME=$OPTARG ;;
|
i) INPUT_FILENAME=$OPTARG ;;
|
||||||
*) echo "$USAGE" >&2; exit 1; # Default.
|
*) echo "$USAGE" >&2; exit 1; # Default.
|
||||||
esac
|
esac
|
||||||
@@ -113,15 +115,16 @@ echo $INPUT_FILE
|
|||||||
for i in `ls $INPUT_FILE| grep .svg `
|
for i in `ls $INPUT_FILE| grep .svg `
|
||||||
do
|
do
|
||||||
ID=`echo "$i" | sed -e 's/;.*//g'`
|
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
|
FILE_PATH=$INPUT_FILE/$PIC_NAME
|
||||||
if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ]
|
if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ]
|
||||||
then
|
then
|
||||||
echo $PIC_NAME exists
|
echo $PIC_NAME exists
|
||||||
else
|
else
|
||||||
RESIZE="${width}x${height}"
|
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"
|
CMDLINE="$CMD $SWITCHES"
|
||||||
|
echo $CMDLINE
|
||||||
(echo $ID; $CMDLINE) &
|
(echo $ID; $CMDLINE) &
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,6 +6,6 @@ if [ -z $PICCREATE ];then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
CMD=convert
|
CMD=convert
|
||||||
SECTION_NAME=jpgs
|
SECTION_NAME=png
|
||||||
|
|
||||||
. $PICCREATE_BIN/generationlib
|
. $PICCREATE_BIN/generationlib
|
||||||
|
|||||||
+5
-5
@@ -21,7 +21,6 @@ def create_picture_frame( config ):
|
|||||||
params = dict()
|
params = dict()
|
||||||
params['width'] = config.get('globals', 'width')
|
params['width'] = config.get('globals', 'width')
|
||||||
params['height'] = config.get('globals', 'height')
|
params['height'] = config.get('globals', 'height')
|
||||||
params['background'] = config.get('globals', 'background')
|
|
||||||
|
|
||||||
#echo '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">'
|
#echo '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">'
|
||||||
begintpl = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
begintpl = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
@@ -34,14 +33,15 @@ def create_picture_frame( config ):
|
|||||||
height="${height}"
|
height="${height}"
|
||||||
>
|
>
|
||||||
'''
|
'''
|
||||||
imagetpl = ''' <image width="${width}" height="${height}"
|
|
||||||
xlink:href="file://${background}">
|
|
||||||
</image>
|
|
||||||
'''
|
|
||||||
svgbegin = Template( begintpl ).substitute(params)
|
svgbegin = Template( begintpl ).substitute(params)
|
||||||
# falls ein Hintergrundbild verwendet werden soll, dann das genauso gross
|
# falls ein Hintergrundbild verwendet werden soll, dann das genauso gross
|
||||||
# machen...
|
# machen...
|
||||||
try:
|
try:
|
||||||
|
params['background'] = config.get('globals', 'background')
|
||||||
|
imagetpl = ''' <image width="${width}" height="${height}"
|
||||||
|
xlink:href="file://${background}">
|
||||||
|
</image>
|
||||||
|
'''
|
||||||
background = config.get('globals', 'background')
|
background = config.get('globals', 'background')
|
||||||
font_path = os.path.expandvars(os.path.join('$PICCREATE_BACKGROUNDS', background ))
|
font_path = os.path.expandvars(os.path.join('$PICCREATE_BACKGROUNDS', background ))
|
||||||
params['background'] = os.path.normpath(font_path)
|
params['background'] = os.path.normpath(font_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user