composite from portion of another 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
philh

composite from portion of another image.

Post by philh »

I've been trying to figure out a way to take a portion of one image and composite it on another with out running a separate convert -crop command, but I'm not having any luck.

So for instance, I'm trying to composite a portion, 1920x50px portion of one image onto a full 1920x1080px image.

Ideas? Any help would be appreciated.

Phil
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: composite from portion of another image.

Post by fmw42 »

see parenthesis processing and clones at http://www.imagemagick.org/Usage/basics/#parenthesis

something like:

convert image1 \( image2 -crop ... +repage \) -geometry +X+Y -compose ... -composite result

see also http://www.imagemagick.org/Usage/crop/#crop_repage
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: composite from portion of another image.

Post by anthony »

fmw42 wrote:see parenthesis processing and clones at http://www.imagemagick.org/Usage/basics/#parenthesis

Code: Select all

convert image1 \( image2 -crop ... +repage \) -geometry +X+Y -compose ... -composite result
Or using image layers, just replace the crop position with the position you want!

Code: Select all

  convert image1 \( image2 -crop ... -set page +X+Y \) -flatten  result
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply