[Digikam-users] How to insert text in a picture

Jean-François Rabasse jean-francois.rabasse at wanadoo.fr
Sun Jun 10 11:09:16 BST 2012


On Fri, 8 Jun 2012, Martin Blank wrote:

> Hallo everybody,
>
> I can insert a text in a picture by using the watermark function. But
> how can I define a text which insert the year of the create field in
> exif data? How can I create a time stamp like some cameras do?

Hello Martin,

Could you explicit a bit more, not what you wish to do, seems clear, but
*how* you wish to do that ?

1. Do you plan to do that from inside Digikam, probably using the batch
    system ?

2. Do you plan to setup a command line script to do that directly in
    your images folders ?

If answer is 1, I personaly don't know. Probably experienced DK users
could help you.

If answer is 2, it's always possible to write a small shell script,
extracting the image date with a metadata reader such as exiftool.
In your case, something like :
  IDATE=`exiftool -exif:datetimeoriginal <Imagefile> | awk '{print $4}'`
will set you a shell variable with full date in format YYYY:MM:DD
(you can tweak that with some 'sed' processing.)

After that, the best way to write text onto an image is probably to use
the Imagemagick convert program, inside your script.
  convert <OriginalImage> ... label-with ${IDATE} ... <AnnotatedImage>

Concert syntax is not always trivial, but there are dozens of examples
you can read and adapt. See http://www.imagemagick.org/Usage/annotating/


Hope this could help,
Jean-François


More information about the Digikam-users mailing list