cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

Get original image crop bounds #119

Open altschuler opened 7 years ago

altschuler commented 7 years ago

Using getCropBounds() I can get the cropped bounds of the canvas, and using a hacky way of getting the clamp properties I can get the bounds of the crop, but they seem to be wrongly scaled.

What I'm after is a way of getting the crop box of the original image so the actual cropping can be done elsewhere.

My own hacky solution is to copy most of the code from getCroppedImage in imageCropper.ts and use the values passed to drawImageIOSFix.

cstefanache commented 7 years ago

You can do the following: HTML: <img-cropper [image]="data" [settings]="cropperSettings" (onCrop)="cropped($event)">

TS: cropped(bounds:Bounds) { console.log(bounds); }

and you will get the correct bounds on cropped event

cstefanache commented 7 years ago

If the behavior is as expected please close the issue.