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!
Crop image, clip out bottom of image
Re: Crop image, clip out bottom of image
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.
--------
--------
Last edited by lwhistler on 2010-09-27T00:29:54-07:00, edited 1 time in total.
Re: Crop image, clip out bottom of image
Following syntax works much better. Is this right?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.
--------
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
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
convert image.png +repage -gravity South -crop 700x200+0+0 +repage bottom.png
Re: Crop image, clip out bottom of image
Works great!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
Thank you very much!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Crop image, clip out bottom of image
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/