scottcheng / cropit

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

Calculate actual crop info #111

Closed williansebastiao closed 9 years ago

williansebastiao commented 9 years ago

Is there any way to retrieve the x and y coordinates? The width and height would also be possible? I'm trying to make a cut but I am not succeeding.

scottcheng commented 9 years ago

Yes. Check out the offset, zoom, and previewSize (or imageSize, depending on what you are looking for) APIs -- docs here.

williansebastiao commented 9 years ago

I looked at the api though, when you cut, the picture is not correct. Already try to offset; previewSize and zoom but no use. it is as if the coordinates were lost

scottcheng commented 9 years ago

The offset that the API returns is offset of the image w.r.t. the crop box. From what you described you seem to be looking for the coordinates of the cropbox w.r.t. the image, which would be (offset.x / zoom, offset.y / zoom).