Page 1 of 1

Crop to clipping path

Posted: 2010-01-21T04:13:30-07:00
by masterbp
Hi

I have images with white background and a clipping path - see example here: http://resources.jysk.com/getimage/pm.l ... 1/WEB/1001

I would like to crop the photo so the closet in the photo takes up as much space as possible. It must be the clipping-path that defines the left, right, top, bottom coordinate for the crop.

Is this possible in a simple way with ImageMagick?

Best regards,

Benny Pedersen

Re: Crop to clipping path

Posted: 2010-08-18T16:17:11-07:00
by zaratol
Out of curiosity:

is this even possible at all with IM?

because all command lines i have seen so far are using the path information to change the color outside and trim to actually shrink the image.

But to use the clipping path so that the canvas of the new image touches the outside of the path, and not to change pixels outside the clipping path, that are still visible - i would not know how to do it

Re: Crop to clipping path

Posted: 2010-08-18T20:49:22-07:00
by anthony
I would clip the image, or at least a copy or trash image. then use -trim and output the crop parameters the trim came up with.

after that you can use those parameters to crop the original image.

It is similar to a sort of 'fuzzy trim' technique for noisy images.
http://www.imagemagick.org/Usage/crop/#trim_blur