Page 1 of 1

Remove background in batch

Posted: 2015-09-05T17:02:55-07:00
by ricardo7227
Hello guys, Im new in this software.
I need to remove background of multiple images, i try with this code:

Code: Select all

composite -compose difference overlay.jpg background.jpg diff.png
convert diff.png -threshold 2600 mask.png
convert overlay.jpg mask.png -alpha off -compose CopyOpacity -composite Final.png
and it works!!
example:
original
Image
background
Image
Result:
Image

Although, How i can convert this code for a batch?
ImageImageImageImageImageImageImage

But i donĀ“t know how to use mogrify. :shock:
Thank you very much. :(

Re: Remove background in batch

Posted: 2015-09-05T19:13:09-07:00
by fmw42
see
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/Usage/basics ... fy_compose

But mogrify will only allow one image in the command line, except for a pre-prepared composite image. So if you cannot make your commands into one convert command with one image and one overlay, then you will need to write a script loop over all the files you want to process.

You should change your composite command to a convert and then try to make all three commands into one convert.

see convert syntax at
http://www.imagemagick.org/Usage/compose/#compose

Re: Remove background in batch

Posted: 2015-09-05T23:27:02-07:00
by ricardo7227
ok, I go to see them

Re: Remove background in batch

Posted: 2015-09-06T10:44:41-07:00
by fmw42
With two composites, I do not think you can use mogrify. You would have to run one mogrify to do the difference and another on the results of the first to do the copy_opacity.