[wellylug] Automation with Image Magick
Wood Brent
pcreso at pcreso.com
Wed Feb 4 11:26:51 NZDT 2004
--- Martin Wehipeihana <martin at actionit.co.nz> wrote:
> >>I am trying to get Image Magick to 'stamp' images
> >>with a line of text.
> >>Essentially shadowing the lettering through the
> >>image. I want to be
> >>able to 'stamp' the file name of the image on the
> >>image.
>
> Have you tried python and PIL (python image lab) ?
>
Done this pretty simply for a webcam.
A shell script can process a list of files, break up the file names to extract
the componenets of the date/time, reassemble them into the desired string(s) to
overlay on the image, then use the ImageMagick mogrify command to writet teh
text to the image, wherever you want on the image. (I actually used convert
rather than mogrify to create a new file, with a new name, without affecting
the original image)
I don't have a copy, but could prob scribble summat out in a few minutes if
necessary.
Basically it was along the lines of:
LIST=`ls *.jpg`
for FILE in $LIST ; do
#use cut to break up $FILE to get the date/time fields
# eg: MONTH=`echo $FILE | cut -b5,6`
# would assign chars 5 & 6 to the variable MONTH
# etc
#reassemble the bits to make the total string you want to write
# eg: LABEL=${YEAR}_${MONTH}_${DAY}_${HR}:${MIN}:${SEC}
# use mogrify or convert to overlay the text on the image
# with -label or -draw (text)
done
see http://www.cit.gu.edu.au/~anthony/graphics/imagick/annotating/
for a good set of instructions. It even describes how you can dim the box of
the image the text is to be written to so the text will always be readable
irrespective of background colour.
Cheers,
Brent Wood
done
More information about the wellylug
mailing list