Page 1 of 1

Crop Question

Posted: 2011-07-29T08:29:48-07:00
by buntone
How would I crop an image if it is bigger the the supplied dimensions and only crop the dimension that is bigger? Here is the command I have right now:

Code: Select all

convert input.tiff -crop 2269x1950+430+0 +repage -endian lsb -colorspace CMYK -compress LZW output.tff
Any help would be appreciated.

Re: Crop Question

Posted: 2011-07-29T09:43:39-07:00
by Bonzo
You have confused me buntone; may need some examples of input sizes and output sizes :?

What about:

Code: Select all

convert input.tiff -gravity center -crop 2269x1950+0+0 +repage -endian lsb -colorspace CMYK -compress LZW output.tff
This will crop around the center or you might be able to use http://www.imagemagick.org/script/comma ... .php#shave

Re: Crop Question

Posted: 2011-07-29T09:50:50-07:00
by fmw42
crop should crop to those dimension specified or the size of the image if smaller. So you should get the proper behaviour you seem to want. If I misunderstand, please clarify further or provide a case where it fails.

For example for this example:

convert rose: -crop 200x200+0+0 +repage rose_cropped.png

the result is still the same size as the original rose: image.

Re: Crop Question

Posted: 2011-07-29T11:06:18-07:00
by buntone
The offset I need messes up everything because it then crops with that offset in mind. Using gravity causes the me to get the wrong part of the image. I want it to only crop if the image dimensions are only bigger than the crop area and ignore the offset otherwise. Is there a way to do this?

Re: Crop Question

Posted: 2011-07-29T12:02:04-07:00
by fmw42
Sorry I am still confused. Can you show us an example of what is happening along with your command. You can upload images to some free server and provide a link here to your images.