Page 1 of 1
Overwriting images in Draw Dim Box annotating method
Posted: 2010-11-06T17:35:11-07:00
by kandy
Hi!
I've a range of jpg files in same folder and i want to annotate all of them.
Here there is Draw Dim Box method which makes new jpg file
anno_dim_draw.jpg
Code: Select all
convert dragon.gif -fill '#0008' -draw 'rectangle 5,128,114,145' -fill white -annotate +10+141 'Faerie Dragon' anno_dim_draw.jpg
How must i compose the command if i want to overwrite my files??
Thank you!
Re: Overwriting images in Draw Dim Box annotating method
Posted: 2010-11-06T17:50:10-07:00
by fmw42
If I understand your question, then just use the same input name for the output name. The input image will then be replaced with the output in your file system.
convert dragon.gif -fill '#0008' -draw 'rectangle 5,128,114,145' -fill white -annotate +10+141 'Faerie Dragon' dragon.gif
or you can use mogrify to do them all at once. But if they are not all the same size and cannot use the same rectangle and annotate coordinates then this will not work as the command must be exactly the same for all images.
cd to the directory with all your images.
mogrify -format jpg -fill '#0008' -draw 'rectangle 5,128,114,145' -fill white -annotate +10+141 *.jpg
see
http://www.imagemagick.org/Usage/basics/#mogrify
WARNING, be careful as this will overwrite all your images in that directory. It is generally better to create a new directory and use the -path option with mogrify so that you don't lose all your source images if you make a mistake. If no mistakes are made, then you can delete the old directory (and rename the new one to the same name as the old one, if you want).
Re: Overwriting images in Draw Dim Box annotating method
Posted: 2010-11-06T17:54:23-07:00
by kandy
>> If I understand your question, then just use the same input name for the output name.
Yes, but i want do it by using mask because all files are same size and same extension.
Ноw can i do it?
PS Thank you very much! I used mogrify and now you are my God!
Re: Overwriting images in Draw Dim Box annotating method
Posted: 2010-11-06T18:14:59-07:00
by fmw42
kandy wrote:
Yes, but i want do it by using mask because all files are same size and same extension.
Ноw can i do it?
I am not sure what you mean by using a mask. You don't show any mask image in your processing above. Can you provide an example command?
Nevertheless, if you have a second image in your command line, then you
cannot use mogrify. It is limited to process one image at a time from a directory of images. No mask images or second images of any kind are allowed in mogrify.
If you need to do processing of lots of images with some other image in the command line (such as doing compositing), then you will have to write a (shell) script with a loop using convert to process each image in some directory.
You could also try using some of the batch processing alternatives shown at
http://www.imagemagick.org/Usage/basics/#mogrify_not