Freehand crop fails on UiImage (with zoom) using Core Graphics iOS

I am using the MDImageCroper utility class for implementing free hand cropping (cropping irregular shaped images). Please refer to the github link for this utility: https://github.com/mohammedDehairy/MDImageCroper.

I need to freehand crop an image from gallery. I made a sample app which attempted to freehand crop irregular shapes from an image by drawing a line on UIImage .

The issue I'm facing:

When the app zooms into the image and then crops it gives me the wrong scaled image. If the app does not zoom into the image - freehand cropping works as expected

I think zooming the image introduces some unpredictable behavior with the scaling size.

Has anyone accomplished anything similar? Can you please suggest/recommend how to implement freehand cropping after zooming into the source image?

Here is a link of my sample app code:https://www.dropbox.com/s/hq09ta8jo9bc6as/MDImageCroper.zip?dl=0

Freehand crop fails on UiImage (with zoom) using Core Graphics iOS
 
 
Q