scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 305 forks source link

Trim background instead of filling it with a color #185

Open autopten opened 8 years ago

autopten commented 8 years ago

Thanks for such a majestic script. I was wondering if it's possible or is there a way to trim the background, instead of filling it with a color using fillBg="#..."

I'd like to avoid this kind of images when the lazy users don't use the zoom or editing tools to get a good shot.

mercho

test_img

Thanks for any help.

EFSpooner commented 8 years ago

Does the following solve your issue/work in your use-case? minZoom: 'fill'

It disables zooming out if the image would not fill the cropper-size anymore, which results in the images you posted.

autopten commented 8 years ago

Thanks, EFSpooner. I already tried that setting but it didn't work.

When users use landscape photos, like this:

kjkj

They end, like this:

jhjkjkj

autopten commented 8 years ago

Solved by saving a copy of the original image in server via canvas and using the imagemagick tool (crop trim color) which doesn't work perfect, still leaves some pixels of the background.

omartadj commented 5 years ago

Just save the image in png format.