Page 1 of 1

Applying a mask to multiple images at the same time

Posted: 2014-04-02T06:32:07-07:00
by Lio
Hello. I've been trying to apply the same mask to multiple images at the same time with one command, but it only seems to affect the first image on the folder.

This is the what I'm using

Code: Select all

composite -compose CopyOpacity mask.jpg *.png
I'm not sure if composite works differently, since I've already used convert and mogrify (like the following example) and it does affect every image on the folder.

Code: Select all

mogrify -resize 500x500! *.jpg
Is what I want possible?If so, any suggestions?

Thanks a lot.

Re: Applying a mask to multiple images at the same time

Posted: 2014-04-02T10:49:41-07:00
by fmw42
composite and convert -composite only work with two images at a time plus an optional mask. But you may be able to use mogrify to do it. See
http://www.imagemagick.org/Usage/basics ... fy_compose, where there is an example of what I think you may want to do.

Re: Applying a mask to multiple images at the same time

Posted: 2014-04-03T09:10:41-07:00
by Lio
Thanks for the answer, I tried that and a couple of other things there, but it doesn't seem to work if I try to use another image as the mask, it seems to be fine if I just draw a shape though. I may be doing something wrong, or maybe it's not supported.

Re: Applying a mask to multiple images at the same time

Posted: 2014-04-03T10:08:49-07:00
by fmw42
Please provide an example of a couple of input images and the mask image and what you expect for the output. Perhaps I misunderstand what you are trying to do. You can upload to dropbox.com (public folder) and put links here.

Re: Applying a mask to multiple images at the same time

Posted: 2014-04-03T11:34:27-07:00
by Lio
Hey. Thanks, but I was probably doing something wrong, a friend of mine that has more scripting knowledge ended up with this script that seems to work perfectly

Code: Select all

C:\foo\bar> for /f %x in ('dir /s /b *.png') do @composite -compose CopyOpacity mask.jpg %x %~dx%~px%~nxXYZ.png