I have improved the script a litte bit and the month is now displayed in a rectangle 7x6 or 7x7 in the south-west corner of the image.



PS: save the following script as calendar-7x7, make it executable (chmod +x calendar-7x7) and call it with



calendar-7x7 year month picture | sh

PPS: Download here u1.ipernity.com/10/47/01/3694701.13aa6bee.zip

#!/bin/sh

[ $# -lt 3 ] && echo "usage calender YEAR MONTH PICTURE" && exit 1

YEAR=${1}
MONTH=${2}
PICTURE=${3}
DIR=${3%/*}

# Get width and height of the picture
W=`identify -format "%w" "${PICTURE}"`
H=`identify -format "%h" "${PICTURE}"`
#W=1280
#H=1024
DEFCOL=Black
COLOR=$DEFCOL
SHADOW=Lightgrey

# 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
fi
# Define the names ot the days
NOFD=(Mo Di Mi Do Fr Sa So)
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 "-size ${W}x${H} xc:none \\"
echo -e "-gravity SouthEast \\"
echo -e "-pointsize 16 -family \"$FONT\" \\"
echo -e "-fill $SHADOW -draw 'text 32,8 \"$SIGN\"' \\"
echo -e "-fill $COLOR -draw 'text 31,7 \"$SIGN\"' \\"


echo -e "-gravity SouthWest \\"
echo -e "-pointsize $((3*PTSIZE/2)) -family \"$FONT\" \\"
X=$((W/64))
Y=$((8*(PTSIZE+5)))
echo -e "-fill $SHADOW -draw 'text $X,$Y \"${NOFM[$((MONTH-1))]} $YEAR\"' \\"
echo -e "-fill $COLOR -draw 'text $((X-1)),$((Y-1)) \"${NOFM[$((MONTH-1))]} $YEAR\"' \\"

Y=$((7*(PTSIZE+5)))
echo -e "-pointsize $PTSIZE -family \"$FONT\" \\"
for (( d=0 ; d < 7 ; d++ ))
do
  X=$((W*(2*d+1)/64))
  WDAY=${NOFD[$d]}
  case "$WDAY" in
   Sa) COLOR=MediumVioletRed ;;
   So) COLOR=Red ;;
   * ) COLOR=$DEFCOL ;;
  esac
  echo "-fill $SHADOW -draw 'text $X,$Y \"$WDAY\"' \\"
  echo "-fill $COLOR -draw " "'text $((X-1)),$((Y-1)) \"$WDAY\"' \\"

done

WDAY1=$(((`date +%w -d "$YEAR-$MONTH-1"`+6)%7))

for (( d=1 ; d <= DINM[MONTH-1] ; d++ ))
do
  X=$((W*(2*((WDAY1+d-1)%7)+1)/64))
  WDAY=${NOFD[$(((WDAY1+d-1) % 7))]}
  case "$WDAY" in
   So) COLOR=Red ;;
   Sa) COLOR=MediumVioletRed ;;
   * ) COLOR=$DEFCOL ;;
  esac
  Y=$(((6-(WDAY1+d-1)/7)*(PTSIZE+5)))
  echo "-fill $SHADOW -draw 'text $X,$Y \"$d\"' \\"
  echo "-fill $COLOR -draw 'text $(($X-1)),$(($Y-1)) \"$d\"' \\"
done
if [ ! "${PICTURE%/*}" = "${PICTURE##*/}" ]
then
	echo "\"${PICTURE}\" \"${PICTURE%/*}/${PREFIX}-${PICTURE##*/}\" "
else
	echo "\"${PICTURE}\" \"${PREFIX}-${PICTURE##*/}\" "
fi