Page 1 of 1

filename on an image

Posted: 2009-09-01T05:15:20-07:00
by goslings
Totally new to this ; want filename on the image as a reference
tried
convert x.png -font Aerial -pointsize 30 -draw "gravity northwest fill black text
0,12 'abcdefg' " xy.png

this writes title "abcdefg" onto file, but is there a way to put the filename title on the image rather than type it and modify the actual file rather than a copy (x.png - xy.png)
lots of files to do in a batch file

tried %f but it does not like it

Re: filename on an image

Posted: 2009-09-01T11:01:33-07:00
by fmw42
if you want your image file to be abcdefg.png

str="abcdefg"
convert x.png -font Aerial -pointsize 30 -draw "gravity northwest fill black text
0,12 $str " $str.png

Re: filename on an image

Posted: 2009-09-01T17:17:34-07:00
by anthony
Don't use -draw use -annotate and use the string %f

For example

Code: Select all

   convert x.png -font Aerial -pointsize 30 -gravity NorthWest -fill black \
              -annotate 0,12 '%f'  xy.png
If you simply want the filename UNDER the image, you can use montage

Code: Select all

   montage -label '%f' x.png \
          -font Arial -pointsize 30 \
          -geometry +0+0 -background silver xy.png
See IM examples, Montage
http://www.imagemagick.org/Usage/montage/

For many other lableing methods: below, above, or on top of the image; using methods that will work with any image: light, dark, caotic; then look at
IM Examples, Annotating Images
http://www.imagemagick.org/Usage/annotating/

Re: filename on an image

Posted: 2009-09-03T05:38:04-07:00
by goslings
thanks all
have many files and wanted to write the filename (very long) on each at upper left corner hence the need to use %f
thanks all