alte dinge
This commit is contained in:
parent
43cce6432e
commit
8885356b3b
2 changed files with 146 additions and 8 deletions
|
@ -22,17 +22,17 @@ import os
|
|||
FILE_PREFIX = "converted_"
|
||||
|
||||
# default: 7
|
||||
CARTOON_RADIUS = 30
|
||||
CARTOON_RADIUS = 50
|
||||
# default: 0.2
|
||||
CARTOON_BLACK = 0.4
|
||||
CARTOON_BLACK = 0.25
|
||||
# default: 2
|
||||
POSTERIZE_COLORS = 4
|
||||
POSTERIZE_COLORS = 9
|
||||
# default: (0, 0, 0)
|
||||
VIGNETTE_COLOR = (0, 0, 0)
|
||||
# default: 60 (%) (Deckkraft)
|
||||
VIGNETTE_COVERAGE = 60
|
||||
VIGNETTE_COVERAGE = 70
|
||||
# default: 5
|
||||
VIGNETTE_RADIUS = 5
|
||||
VIGNETTE_RADIUS = -10
|
||||
# default: 75 (Haerte)
|
||||
VIGNETTE_STRENGTH = 75
|
||||
|
||||
|
@ -44,11 +44,10 @@ def get_output_filename(infilename):
|
|||
def handle_file(infilename):
|
||||
#pic = gimp.pdb.file_jpeg_load(infilename, gimpfu.RUN_NONINTERACTIVE)
|
||||
pic = gimp.pdb.gimp_file_load(infilename, gimpfu.RUN_NONINTERACTIVE)
|
||||
layer = pic.layers[0]
|
||||
layer = pic.layers[0-1]
|
||||
gimp.pdb.plug_in_cartoon(pic, layer, CARTOON_RADIUS, CARTOON_BLACK)
|
||||
gimp.pdb.gimp_posterize(layer, POSTERIZE_COLORS)
|
||||
gimp.pdb.script_fu_photo_vignette(pic, layer,
|
||||
VIGNETTE_COLOR, VIGNETTE_COVERAGE, VIGNETTE_RADIUS, VIGNETTE_STRENGTH)
|
||||
gimp.pdb.script_fu_photo_vignette(pic, layer, VIGNETTE_COLOR, VIGNETTE_COVERAGE, VIGNETTE_RADIUS, VIGNETTE_STRENGTH)
|
||||
output_filename = get_output_filename(infilename)
|
||||
gimp.pdb.gimp_file_save(pic, layer, output_filename, output_filename, run_mode=gimpfu.RUN_NONINTERACTIVE)
|
||||
|
||||
|
|
139
ssw/ssw.sh
Executable file
139
ssw/ssw.sh
Executable file
|
@ -0,0 +1,139 @@
|
|||
#!/bin/bash
|
||||
startdate=""
|
||||
barlength=""
|
||||
totalday=""
|
||||
|
||||
while getopts "s:t:l:h?" opt; do
|
||||
case $opt in
|
||||
s)
|
||||
startdate=$OPTARG
|
||||
;;
|
||||
l)
|
||||
barlength=$OPTARG
|
||||
;;
|
||||
t)
|
||||
totalday=$OPTARG
|
||||
;;
|
||||
?) echo "
|
||||
|
||||
argument not recognized
|
||||
USAGE: ssw -s YYYY-MM-TT -l NUM -t NUM
|
||||
-s alternative start date (actual 2010-01-11)
|
||||
-l barlength (actual 50)
|
||||
-t total days (actual 280)
|
||||
-h this help
|
||||
|
||||
"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#################################################### Variablen
|
||||
|
||||
if [[ "$startdate" == "" ]]; then
|
||||
startdate='2010-10-10' # Pseudo Start YYYY-MM-TT
|
||||
fi
|
||||
if [[ "$totalday" == "" ]]; then
|
||||
totalday=280 # Dauer in Tagen
|
||||
fi
|
||||
if [[ "$barlength" == "" ]]; then
|
||||
barlength=50 # Laenge des Balken in Zeichen
|
||||
fi
|
||||
space=' ' # Spacerfi
|
||||
|
||||
|
||||
#################################################### Tagesrechnung
|
||||
|
||||
startday=$[($(date -d "$startdate" +%s)+86399)/86400]
|
||||
nowday=$[$(date +%s)/86400]
|
||||
endday=$[$startday+$totalday]
|
||||
|
||||
x0=$[($nowday-$startday)*$barlength/$totalday]
|
||||
|
||||
for ((i=1;i<=$barlength;i++)); do
|
||||
if [ $i -le $x0 ];then
|
||||
bar1=$bar1"|"
|
||||
else
|
||||
bar1=$bar1"-"
|
||||
fi
|
||||
done
|
||||
|
||||
#################################################### Prozentbalken
|
||||
|
||||
a1=$[($nowday-$startday)*100/$totalday]
|
||||
a2=$[100-$a1]
|
||||
x1=$[$x0-${#a1}-1]
|
||||
if [ $x1 -lt 1 ];then
|
||||
x1=0
|
||||
fi
|
||||
a3=$[$barlength-${#a1}-${#a2}-2-$x1]
|
||||
|
||||
for ((i=1;i<=$x1;i++)); do
|
||||
bar2=$bar2$space
|
||||
done
|
||||
|
||||
bar2=$bar2$a1"%"
|
||||
|
||||
for ((i=1;i<=$a3;i++)); do
|
||||
bar2=$bar2$space
|
||||
done
|
||||
|
||||
bar2=$bar2$a2"%"
|
||||
|
||||
#################################################### Wochenbalken
|
||||
wochen=$[($nowday-$startday-1)/7]
|
||||
tage=$[$nowday-$startday-$wochen*7]
|
||||
b1=$wochen"w"$tage"t"
|
||||
b2=$[($endday-$nowday-1)/7]"w"$[($endday-$nowday)-(($endday-$nowday-1)/7)*7]"t"
|
||||
x2=$[$x0-${#b1}]
|
||||
if [ $x2 -lt 1 ];then
|
||||
x2=0
|
||||
fi
|
||||
b3=$[$barlength-${#b1}-${#b2}-$x2]
|
||||
|
||||
for ((i=1;i<=$x2;i++)); do
|
||||
bar3=$bar3$space
|
||||
done
|
||||
|
||||
bar3=$bar3$b1
|
||||
|
||||
for ((i=1;i<=$b3;i++)); do
|
||||
bar3=$bar3$space
|
||||
done
|
||||
|
||||
bar3=$bar3$b2
|
||||
|
||||
#################################################### Datumsbalken
|
||||
|
||||
diffday=$[$endday-$nowday]
|
||||
|
||||
c1=$(date +%e"."%m"."%y)
|
||||
c2=$(date -d "today +$diffday day" +%e"."%m"."%y)
|
||||
x3=$[$x0-${#c1}]
|
||||
if [ $x3 -lt 1 ];then
|
||||
x3=0
|
||||
fi
|
||||
c3=$[$barlength-${#c1}-${#c2}-$x3]
|
||||
for ((i=1;i<=$x3;i++)); do
|
||||
bar4=$bar4$space
|
||||
done
|
||||
|
||||
bar4=$bar4$c1
|
||||
|
||||
for ((i=1;i<=$c3;i++)); do
|
||||
bar4=$bar4$space
|
||||
done
|
||||
|
||||
bar4=$bar4$c2
|
||||
|
||||
#################################################### Output
|
||||
|
||||
echo "$bar1
|
||||
$bar3
|
||||
$bar2
|
||||
$bar4"
|
||||
|
||||
# Balken in Bilddatei zeichnen
|
||||
#convert -font helvetica -fill white -pointsize 20 -draw "text 1150,1180 '$b1 $bar1 $b2'" ~/bild.jpg ~/bild_mit_balken.jpg
|
||||
|
Loading…
Reference in a new issue