Page 1 of 1

Overlay one image on multiple (or single) image???

Posted: 2013-06-13T11:24:53-07:00
by flipjarg
My work computer only has Windows 7 on it. Sometimes I need to overlay one image on many different images. Below is the code I am trying to use... but it doesn't work. I'm used to just using a loop in BASH and calling it good so I'm not totally familiar with `morgify`. I'm hoping someone can help me. I've added a right click menu option to do this but the only thing working is the command I've written for ImageMagick... any ideas on how to get this working would be appreciated.

Code: Select all

"C:\Program Files (x86)\ImageMagick-6.8.2-Q16\mogrify.exe" -gravity SouthEast C:\Users\ARSIMS\Desktop\efficiency\myOverlayImage.png
On another note, I have a similar command working to resize all images to 640px wide... not sure why the above is not working.

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T11:36:53-07:00
by fmw42
Use mogrify with -draw to overlay your common image onto each of the other images.

see
http://www.imagemagick.org/Usage/basics ... fy_compose

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T11:50:16-07:00
by flipjarg
So for my situation, I would assume the following code would be what I need but it doesn't work. :(

Code: Select all

"C:\Program Files (x86)\ImageMagick-6.8.2-Q16\mogrify.exe" -alpha Set -draw 'image Dst_In 0,0 0,0 "C:\Users\ARSIMS\Desktop\efficiency\myOverLayImage.png"'  mogrify_*.jpg
Also, I assume mogrify_*.jpg will be the name of the output file(s). Is there a way to just overwrite the current file?

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T12:50:37-07:00
by fmw42
try

mogrify.exe -format jpg -draw "image Over 0,0 0,0 'C:\Users\ARSIMS\Desktop\efficiency\myOverLayImage.png'" *.jpg

Note the single and double quotes are different from yours. The *.jpg should replace all jpg images with the same names. The -format jpg will change all images to jpg. If you want to process all images and don't want to change the format, then leave off the -format and just use * at the end without the .jpg

Does your image have transparency? Is it the same size as all the background images? If it is smaller, then you probably want to place it at some locations in the background images. Right now it will be placed at the upper left corner of the background images. So you may want to change the draw coordinates to x,y offsets and specify the image size rather than 0,0 0,0.

see image option at
http://www.imagemagick.org/script/magic ... aphics.php

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T13:19:56-07:00
by flipjarg
Okay, I see what you're saying. The code you provided above works. Now I just need to figure out how to apply this to my right click menu so it only ads the overlayed image to the selected files. I will post when (if) I figure that part out for anyone who might be searching for this later. :D

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T13:34:19-07:00
by flipjarg
Just took a look at my other code an figured it out. Instead of using *.jpg I need to use "%1" which passes all selected files to the command that is being run. The following code puts my watermark image over the image:

Code: Select all

mogrify.exe -draw "image Over 0,0 0,0 'C:\Users\ARSIMS\Desktop\efficiency\myOverlayImage.png'" "%1"

Re: Overlay one image on multiple (or single) image???

Posted: 2013-06-13T13:43:58-07:00
by GreenKoopa
I was just about to suggest that. ~modifiers to %1 can also be useful in some circumstances.
http://www.microsoft.com/resources/docu ... rcent.mspx
http://www.imagemagick.org/Usage/windows/#filenames