I use following codes to batch annotate my images using ImageMagick convert function under Windows7 system.
for %i in (*.png) do convert %i -fill yellow -box green -gravity South -pointsize 20 -annotate +0+0 (a) "%~niAnnotated.png"
My questions are:
1. How to change the annotated text (a) into (a), (b), (c), ... as looping the images?
2. how to add -trim function to remove the white space around the images with annotation. I use the script above with -trim but remove my annotation as well.
Thanks.
Aaron.
How to batch annotate my images?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to batch annotate my images?
1. IM will use whatever text you specify. This could be an environment variable, in this case set up by the "for" loop. For example, you might have a file containing a list of filenames and captions. Your script could read this file. For each *.png, use the caption if it has one, otherwise use the filename. But this is all about scripting, not ImageMagick.
2. I don't understand the question. If you want to ensure that only white (not green etc) pixels are trimmed, add a white border first:
2. I don't understand the question. If you want to ensure that only white (not green etc) pixels are trimmed, add a white border first:
Code: Select all
convert rose: -fill Yellow -box green -gravity South -pointsize 20 -annotate +0+0 (abc) -bordercolor White -border 1 -trim c.png
snibgo's IM pages: im.snibgo.com