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

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?".
Post Reply
flipjarg
Posts: 7
Joined: 2013-06-13T11:18:30-07:00
Authentication code: 6789

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
flipjarg
Posts: 7
Joined: 2013-06-13T11:18:30-07:00
Authentication code: 6789

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

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
flipjarg
Posts: 7
Joined: 2013-06-13T11:18:30-07:00
Authentication code: 6789

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

Post 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
flipjarg
Posts: 7
Joined: 2013-06-13T11:18:30-07:00
Authentication code: 6789

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

Post 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"
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

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

Post 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
Post Reply