As far as I know I can crop a picture to a height of 3000 pixels by the following command:
convert in.jpg -crop x9000+0+0 +repage out.jpg
However the cropped part is here always at the bottom of the picture.
How can I tell ImageMagick to only crop at the top of the picture?
How can I tell Imagemagick to crop 32pixels at the top regardless of how height the picture is in total?
How can I specify to crop 22 pixels at the top and 10 pixels at the bottom?
Ben
How to crop 32 pixels at the top?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to crop 32 pixels at the top?
No. If you want a height of 3000 pixels, ask for 3000, not 9000.bensto wrote:As far as I know I can crop a picture to a height of 3000 pixels by the following command:
convert in.jpg -crop x9000+0+0 +repage out.jpg
Precede with "-gravity" if you want, eg "-gravity North" to get rows from the top of the image, or South to get rows from the bottom.
To remove a certain number from the top or bottom, use "-gravity XX -chop". See http://www.imagemagick.org/script/comma ... s.php#chop
snibgo's IM pages: im.snibgo.com
Re: How to crop 32 pixels at the top?
Thank you.
Is the chop operation lossless?
After applying
convert.exe test.jpg -gravity North -chop x160 +repage out.jpg
in the resulting picture the heaven seems to be much more blue than in the original.
Is the chop operation lossless?
After applying
convert.exe test.jpg -gravity North -chop x160 +repage out.jpg
in the resulting picture the heaven seems to be much more blue than in the original.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to crop 32 pixels at the top?
Chop is lossless. The issue is that you are using jpg images. They are lossy compressed. So your image must be decompressed, chopped and recompressed and this will not be lossless.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to crop 32 pixels at the top?
"-chop" removes pixels. It doesn't change pixels.
Writing to JPEG is lossy. Pixels will change. But I doubt that "seems to be much more blue" comes from that. That's more likely to be an illusion.
Writing to JPEG is lossy. Pixels will change. But I doubt that "seems to be much more blue" comes from that. That's more likely to be an illusion.
snibgo's IM pages: im.snibgo.com
Re: How to crop 32 pixels at the top?
Thank you for clarification.
However after ImageMagick decompressed (internally) the *.jpg and applied the -chop command a re-compression takes place:
At which compression level (by default)?
Assume I want a compression level of 97%: How can I specify this in the convert command above?
However after ImageMagick decompressed (internally) the *.jpg and applied the -chop command a re-compression takes place:
At which compression level (by default)?
Assume I want a compression level of 97%: How can I specify this in the convert command above?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to crop 32 pixels at the top?
JPEG compression is controlled by "-quality". See http://www.imagemagick.org/script/comma ... hp#quality . This is a number from 1 to 100, but not a percentage.
snibgo's IM pages: im.snibgo.com