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?".
So I've written a small shell script to batch caption/title a directory of images with a 20px bar on the top and include copyright info in a 20px bar on the bottom. What I'm wondering is if there is a better way to do it, or if my script can be leaner or more efficient. This was my first real attempt at using ImageMagick to work with my files in a batched manner, so I'm quite pleased that I got everything to do what I wanted - but now I want it better. Anyone able to offer suggestions to improve this? Or should I just leave it alone since it already works...
I believe you can put two -annotate commands in the same command line with different -gravity settings and write right on the image. But the text won't auto wrap like caption:, but your example does not show any need for wrapping.
convert inputimage .... -gravity north -annotate +0+0 "some text" -gravity south -annotate +0+0 "some other text" resultimage
Thanks fmw42, that seems to do what I'd like it to - I'll need to work with it a bit more tonight and see if I can get it adjusted some. Initially I'm seeing it create a new image instead of writing on top of the original, which is great for preserving data but undesirable behavior if it works correctly. My original script will write over the top of existing text with a new black box and white text, effectively erasing it - while the version with annotate just writes the white text on top of the current text.
Reading through the notes on annotate now and trying to see if I can duplicate my previous results - thanks for pointing me at a different way to do this, once I figure it out I can strip a couple lines out of my script ;) and will have learned a bit more too. Much appreciated.
The biggest problem is making sure the overlaid test remains visible.
Also while PNG is a non-lossy format, I still recommend merging multiple into a single command if possible.
Also use the shell link continuation techniques to divide up the operations to make it easier to read, follow and modify. The examples do this in just about every example.