How to put filename onto the image with "mogrify"?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
grisha

How to put filename onto the image with "mogrify"?

Post by grisha »

Hi.

I've 182 png images that are in a certain order. I've renamed the filenames according to it. So it goes from 000.png.....to 181.png.

The images will be printed and I would like to include this number on the images.
I've tried the following command:


mogrify -gravity southwest -font Times-New-Roman-bold -pointsize 12 -fill green -draw "text 5,5 '%f'" *.png

The program puts %f on the images, but not the actual filename.

I've tried different operands, like $f, %filename, $filename, filename, but with the same result.
I've also tried it on different OSs, like Linux (ubuntu 10.04, ver 6.5.7.8) and windows XP ImageMagick-6.6.2-4-Q16-windows-dll, and Win7 ImageMagick-6.6.2-4-Q16-windows-x64-static.

Anyone could help?
I would really appreciate a help.



Thx
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to put filename onto the image with "mogrify"?

Post by snibgo »

"-draw" doesn't take expand escapes.

Alternatives include using "-annotate", which does expand escapes, or using environment variables.
snibgo's IM pages: im.snibgo.com
Post Reply