Page 1 of 1

Crop image, clip out bottom of image

Posted: 2010-09-26T23:59:50-07:00
by boromb
Hello,

I'm trying to extract bottom of a image to a new file.
The image is about 700width and 842 height.
I want to clip out 200 in height from bottom up.

convert.exe image.png -crop 700x200+0+842 +repage bottom.png

I get a new image but I don't feel that I'm doing this right because I get different from file to file.

Is that syntax right?

Best regards!

Re: Crop image, clip out bottom of image

Posted: 2010-09-27T00:19:32-07:00
by lwhistler
x y starts at the top left of the images so 842 should be 842-200= 642 If you are bulk processing different size of images then you have loop through the image sizes to minus 200 from the height for the start position of the crop.


--------

Re: Crop image, clip out bottom of image

Posted: 2010-09-27T00:29:14-07:00
by boromb
lwhistler wrote:x y starts at the top left of the images so 842 should be 842-200= 642 If you are bulk processing different size of images then you have loop through the image sizes to minus 200 from the height for the start position of the crop.


--------
Following syntax works much better. Is this right? :)

convert.exe image.png -gravity South -crop 700x200+0-50 +repage bottom.png

For some reason I need "-50" to get all of the bottom image. Otherwise ImageMagick doesn't
crop from the bottom.

How would your syntax look like?

Regards!

Re: Crop image, clip out bottom of image

Posted: 2010-09-27T01:29:10-07:00
by Drarakel
Your command should work without "-50". But maybe some of your PNG files already have an offset. If you don't need these offsets anymore, then also add "+repage" at the start of your command:
convert image.png +repage -gravity South -crop 700x200+0+0 +repage bottom.png

Re: Crop image, clip out bottom of image

Posted: 2010-09-27T01:51:56-07:00
by boromb
Drarakel wrote:Your command should work without "-50". But maybe some of your PNG files already have an offset. If you don't need these offsets anymore, then also add "+repage" at the start of your command:
convert image.png +repage -gravity South -crop 700x200+0+0 +repage bottom.png
Works great!

Thank you very much!

Re: Crop image, clip out bottom of image

Posted: 2010-09-27T07:07:40-07:00
by anthony
The better ideal is to have that +repage before the final save in whatever it was that created those PNG images.

Typically it is caused by either a -crop, -trim or +distort, and is needed for special operations such as image layering, which is why these operations can generate offsets (usually to preserve some information about the image.

If it is unwanted it should have been removed immediately after those operations.