Add date watermark to jpg images


I am attempting to add a watermark to images that contains the date.

I am not having any trouble putting text on images but as soon as I try and put a date I get unpredicted results.

convert -pointsize 20 -fill blue -draw 'text 10,240 "$(date '+%Y-%m-%d %T').jpg" ' /home/mydir/timelapse/snap.jpg /home/mydir/timelapse/snapout.jpg;

the above command returns

convert: non-conforming drawing primitive definition `$(date +%Y-%m-%d-%T).jpg' @ error/draw.c/DrawImage/3182.

I'm pulling my hair out trying to figure why I cannot put a date on my image.

Best Answer

  • I believe you just need to change your double and single quotes around. Try this instead:

    convert -pointsize 20 -fill blue -draw "text 10,240 '$(date '+%Y-%m-%d %T').jpg' " /home/mydir/timelapse/snap.jpg /home/mydir/timelapse/snapout.jpg;