Page 1 of 1

Copy and paste .tiff parts

Posted: 2007-09-28T13:21:10-07:00
by cletcher
Hi there. I am a complete noob to this, thanks in advance for the help.

I am trying to take a given piece of a .tiff image and over write the same section of a different, identically sized image. If this can be done in 1 or two steps that would be great.

Thanks again!
Chris

Re: Copy and paste .tiff parts

Posted: 2007-09-30T18:56:58-07:00
by anthony
What do you mean by the same section?

If the image is the same size (without transparency) over writing the other image will just replicate the original image.

However try this

Code: Select all

   convert overlay.tiff background.tiff  result.tiff
For more see IM Examples, Alpha Composition
http://www.imagemagick.org/Usage/compose/

Re: Copy and paste .tiff parts

Posted: 2007-10-01T09:33:52-07:00
by cletcher
Thanks for the reply. That's not quite what i'm looking to do. I'll try to be more clear.

If the total size of both images was 400X1000, I would like able to take a piece of it like 100X100 to 300X300 (a 200X200 square) of the first image and paste it in the same spot on the second image without altering the rest of the second image.

Re: Copy and paste .tiff parts

Posted: 2007-10-01T23:19:50-07:00
by anthony
Oh... Thatsi quite easy... crop and flatten, don't remove the offset from the cropped image!

Code: Select all

convert  image1.tiff   -crop 200x200+100+100 \
             image2.tiff  +swap  -background none -flatten \
             output.tiff
the +swap in the above is to re-order the images so the second image is under the first. The -background is NOT needed if the images are fully opaque (no transparency).

An alturnative is....

Code: Select all

convert  image2.tiff  \( image1.tiff   -crop 200x200+100+100 \) \
             -composite  output.tiff
This uses parentheses rather than swapping image order. without the parenthesis the crop would crop BOTH images. It then uses -composite to combine just those two images.

See IM Examples, "Basics" for image ordering and parenthesis, and "Mosaics" for Flattening a sequence of two or more images on top of each other. Also look and "Alpha Composition" for more of the composition operators.

Re: Copy and paste .tiff parts

Posted: 2007-10-02T19:36:45-07:00
by cletcher
Perfect, thanks!

Re: Copy and paste .tiff parts

Posted: 2007-10-03T20:05:49-07:00
by cletcher
What would be the easiest way to determine the co-ordinates of the area that I wish to crop?

Re: Copy and paste .tiff parts

Posted: 2007-10-03T20:53:12-07:00
by anthony
Launch some image editor and write down the coordinates. I use a very old program called XV which pressing the middle button on the image pops up color and position information.

I am also planing some PerlTk type of programs to display images, and locate coordinates and do trial Magick runs to do manual panarama composite image registration (finding specific matching points in two images).