Page 1 of 1

Crop image keeping original position

Posted: 2019-09-30T10:56:19-07:00
by tester
Hi!!

Having
Image
https://upload.wikimedia.org/wikipedia/ ... go.svg.png

I would like to cut the lion but keep the original image size and lion in place.

right now i'm only able to cut the lion and keep the original image size, but not lion's position:

Code: Select all

convert /tmp/stratton.png -crop 550x800+320+30 -background none  -extent 1200x1920 /tmp/output.png
Image

Re: Crop image keeping original position

Posted: 2019-09-30T12:43:13-07:00
by snibgo
I'm not sure what you want. After crop, the image has an offset in a canvas, so we can flatten to use that entire canvas if we want:

Code: Select all

magick 1200px-Stratton_Oakmont_logo_svg.png -crop 550x800+320+30 -background Blue -layers Flatten x.png
Is that what you want?

Re: Crop image keeping original position

Posted: 2019-09-30T23:04:46-07:00
by tester
Yes! That's exactly what i wanted!
I will have to read more about what layers does. ty!

This is my final code! :P

Code: Select all

 convert /tmp/stratton.png -crop 550x800+320+30 -background none -layers Flatten /tmp/lion.png

 convert /tmp/stratton.png -crop 250x800+320+300 -background none -layers Flatten /tmp/title.png

convert /tmp/lion.png /tmp/title.png  -background none -layers Flatten /tmp/final.png