To create the calender-page I used the followin script, which creates the ImageMagick "convert"-command. The picture is created with following command:
convert 2009 1 bild.jpg | sh
calendar 2009 1 bild.jpg | sh
First parameter is the year, second the month with January = 1 and the third is the name of the picture.
If you call only "calendar 2009 1 bild.jpg" the script will type the convert command with all parameters on stdout.
Save the following script as calendar. Make it executable with "chmod u+x calendar". The script will type the "convert"-command with Parameters to stdout, to produce the picture pipe the output to a shell.
PS: Download here https://www.test.ipernity.com/doc/20310/3694701?from=3694701&at=1229982134
#!/bin/sh [ $# -lt 3 ] && echo "usage calender YEAR MONTH PICTURE" && exit 1 YEAR=${1} MONTH=${2} PICTURE=${3} # Get width and height of the picture W=`identify -format "%w" ${PICTURE}` H=`identify -format "%h" ${PICTURE}` # Define the number of days in a mmonth DINM=(31 28 31 30 31 30 31 31 30 31 30 31) # Define the names ot the days NOFD=(So Mo Di Mi Do Fr Sa) NOFM=(Januar Februar März April Mai Juni Juli August September Oktober November Dezember) PREFIX="ip" FONT="Andy MT" PTSIZE=$((H/40)) SIGN="© 2008,2009 by Byggvir of Barley" echo -e "convert \\" echo -e "-gravity North \\" echo -e "-pointsize 128 -family \"$FONT\" \\" echo -e "-fill Black -draw 'text 32,8 \"${NOFM[$((MONTH-1))]} $YEAR\"' \\" echo -e "-fill Lightgrey -draw 'text 31,7 \"${NOFM[$((MONTH-1))]} $YEAR\"' \\" echo -e "-gravity SouthEast \\" echo -e "-pointsize 16 -family \"$FONT\" \\" echo -e "-fill Black -draw 'text 32,8 \"$SIGN\"' \\" echo -e "-fill Lightgrey -draw 'text 31,7 \"$SIGN\"' \\" echo -e "-gravity NorthWest \\" echo -e "-pointsize $PTSIZE -family \"$FONT\" \\" for (( d=1 ; d <= DINM[MONTH-1] ; d++ )) do X=$((W*(2*d-1)/2/(DINM[MONTH-1]+1))) Y=$((H-3*PTSIZE-5)) WDAY=${NOFD[`date +%w -d "$YEAR-$MONTH-$d"`]} case "$WDAY" in So) COLOR=Red ;; Sa) COLOR=MediumVioletRed ;; * ) COLOR=Lightgrey ;; esac echo "-fill Black -draw 'text $X,$Y \"$WDAY\"' \\" echo "-fill $COLOR -draw " "'text $(($X-1)),$(($Y-1)) \"$WDAY\"' \\" Y=$((H-2*PTSIZE)) echo "-fill Black -draw 'text $X,$Y \"$d\"' \\" echo "-fill $COLOR -draw 'text $(($X-1)),$(($Y-1)) \"$d\"' \\" done echo "${PICTURE} ${PREFIX}-${PICTURE}"
Thomas Arend aka Byg… has replied to DornenwolfDer erste Parameter ist das Jahr. der zweite der Monat mit Januar = 1, der dritte Parameter ist das Bild.
Es funktioniert nur mit querformatigen Bildern vernünftig. Für Hochformat muss die PTSIZE anders berechnet werden. Siehe www.ipernity.com/blog/byggvir/116046.
Für Hooch- und Querformat ersteze die Zeile mit "PTSIZE=" durch
PTSIZE=$(((W>H?H:W)/40))
u1.ipernity.com/10/47/01/3694701.13aa6bee.zip?download=Linux%20Scripts%20for%20Calendar-Pages.zip
#!/bin/sh
[ $# -lt 3 ] && echo "usage $0 YEAR MONTH PICTURE" && exit 1
YEAR=${1}
MONTH=${2}
PICTURE=${3}
# Get width and height of the picture
W=`identify -format "%w" "${PICTURE}"`
H=`identify -format "%h" "${PICTURE}"`
# Define the number of days in a mmonth
DINM=(31 28 31 30 31 30 31 31 30 31 30 31)
if [ $((YEAR % 4)) -eq 0 ]
then
DINM[1]=29
if [ ( $((YEAR % 100)) -eq 0 ) -a ( $((YEAR % 400)) -ne 0 ) ]
then
DINM[1]=28
fi
fi
# Define the names ot the days
NOFD=(So Mo Di Mi Do Fr Sa)
NOFM=(Januar Februar März April Mai Juni Juli August September Oktober November Dezember)
PREFIX="ip"
FONT="Andy MT"
PTSIZE=$(((W>H?H:W)/40))
SIGN="© 2008,2009 by Byggvir of Barley"
echo -e "convert \\"
echo -e "-gravity North \\"
echo -e "-pointsize 128 -family \"$FONT\" \\"
echo -e "-fill Black -draw 'text 36,12 \"${NOFM[$((MONTH-1))]} $YEAR\"' \\"
echo -e "-fill Lightgrey -draw 'text 31,7 \"${NOFM[$((MONTH-1))]} $YEAR\"' \\"
echo -e "-gravity SouthEast \\"
echo -e "-pointsize 16 -family \"$FONT\" \\"
echo -e "-fill Black -draw 'text 32,8 \"$SIGN\"' \\"
echo -e "-fill Lightgrey -draw 'text 31,7 \"$SIGN\"' \\"
echo -e "-gravity NorthWest \\"
echo -e "-pointsize $PTSIZE -family \"$FONT\" \\"
COLSHADOW=Lightgrey
for (( d=1 ; d <= DINM[MONTH-1] ; d++ ))
do
X=$((W*(2*d-1)/2/(DINM[MONTH-1]+1)))
Y=$((H-3*PTSIZE-5))
WDAY=${NOFD[`date +%w -d "$YEAR-$MONTH-$d"`]}
case "$WDAY" in
So) COLOR=Red ;;
Sa) COLOR=MediumVioletRed ;;
* ) COLOR=Black ;;
esac
echo "-fill $COLSHADOW -draw 'text $X,$Y \"$WDAY\"' \\"
echo "-fill $COLOR -draw " "'text $(($X-1)),$(($Y-1)) \"$WDAY\"' \\"
Y=$((H-2*PTSIZE))
echo "-fill $COLSHADOW -draw 'text $X,$Y \"$d\"' \\"
echo "-fill $COLOR -draw 'text $(($X-1)),$(($Y-1)) \"$d\"' \\"
done
echo "\"${PICTURE}\" \"${PICTURE%/*}/${PREFIX}-${PICTURE##*/}\" "
Sign-in to write a comment.