robe007
robe007

Reputation: 3917

Crop part of an image and paste it into another with Imagemagick does not work

I have two images and I want to crop a part of the first one, and paste it into the other one in a specific place using imagemagick. Also the crop part would be gray

I want this: https://i.sstatic.net/3gxSP.jpg

But I got this: https://i.sstatic.net/JzWWg.jpg

I have tried:

convert source.jpg ( +clone -crop 240x270+595+140 -resize 112x146 -type Grayscale ) -geometry +10+200 -composite destiny.jpg

but as you see, it does not works as expected.

Although the crop part is cloned as gray, the whole first image is cloned too, but I need to keep in background the second image in color and the crop part in gray in front of it.

Some ideas?

Upvotes: 0

Views: 1917

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207355

From our discussion in chat, I think you need something along these lines - you may need to fiddle with the actual numbers but hopefully the concept is clear:

convert other.jpg \( source.jpg -crop 240x270+595+140 -colorspace gray -resize 116x150! \) -geometry +4+108 -composite result.png

Upvotes: 1

Related Questions