Hello,
Using batch processing, how can I copy a rectangle area of an image to another area of that same image please?
Thanks,
J.
Copy an area of an image to itself
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Copy an area of an image to itself
I do not think that mogrify will allow you to do that, since the overlay image must be the same for all input images. So I think you will need to write a script to loop over each image and use convert to do the processing. The script will be OS dependent. What version of IM are you using and what platform.
The basic convert command will be something like the following:
Unix:
Window:
Where WxH+X1+X2 is the subsection to be copied W=width, H=height, X1,Y1=top left corner of subsection and X2,Y2 is the new location in the input for placement of the top left corner of the subsection
See
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/layers/#convert
The basic convert command will be something like the following:
Unix:
Code: Select all
convert image \( -clone -crop WxH+X1+Y1 +repage \) -geometry +X2+Y2 -compose over -composite result
Code: Select all
convert image ( -clone -crop WxH+X1+Y1 +repage ) -geometry +X2+Y2 -compose over -composite result
See
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/layers/#convert
Re: Copy an area of an image to itself
Hello fmw42,
Thank you very much for your fast answer. It perfectly solved my need!
J.
Thank you very much for your fast answer. It perfectly solved my need!
J.