Latest discussions
Hintergrund ändern bei Makro Aufnahmen (Photoshop)
Updated 6 months ago
2 replies
Links zu Tutorials etc. / Links for tutorials
Updated 10 months ago
1 reply
PDF-Präsentatio n in Photoshop
Updated 10 months ago
Self frame
Updated 10 months ago
Kalender with ImageMagick
GIF-Animation mit ImageMagick
Updated 11 months ago
Veränderung mit Photoshop Elements
Updated 11 months ago
6 replies
Rahmen
Updated 11 months ago
1 reply
macrostudio im Eimer
Updated 12 months ago
4 replies
"Available Light" Portrait
Updated 12 months ago
1 reply
... view all the discussions

Kalender with ImageMagick

posted by Byggvir of Barley
Posted on Friday December 19, 2008 at 16:37. 52 visits. ( permalink )

For an update of this description please visit my blog here and here

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







#!/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}"

This topic has been edited by Byggvir of Barley 10 months ago.

1 Reply

Gartenfreuden (Wolfgang) pro says:
Kannst Du mir etwas Hilfe geben. Ich bekomme es nicht hin. Einfache Befehle bei ImageMagick klappen ja noch. Aber wie binde ich das Script ein? Das Script habe ich abgespeichert als kalender.sh,und ausführbar. richtig oder falsch?? Im Terminal (Ubuntu) bin ich ins aktuelle Verzeichnis gewechselt. Bild habe ich bild.jpg benannt. Im Terminal habe ich dann den convert Befehl mit den drei Paramern eingegeben sowie Pipe kalender.sh. Klappte aber nicht? Was mache ich falsch? Würde mich freuen, wenn Du mir hilfst.
Posted 11 months ago. ( permalink / translate )

You must be logged on to post a reply. Sign in now?


rss Latest comments – Subscribe to the comment feed for this topic.

 

Català | Čeština nové | 中文 | Deutsch | English | Español | Esperanto | Ελληνικά | Français | Galego | Italiano | Nederlands | Português | More...