Crop image taken from camera or photot library by custom shape before uploading

Hi,

In my ionic 2 app I need to crop image taken from camera or chosen from library. I have used cordova-plugin-crop. But it only crops in square shape. If I go to the plugin code and comment the .asSquare() method then it works. I do not want to change plugin code. Even I have used cropperjs but it did not work as I expected. Is there any other alternative ?

Thanx in advance for anyone who could help.

The screenshot at GitHub - jeduan/cordova-plugin-crop: Crop an image in Cordova doesn’t really look square.
Where exactly are you commenting out a line? (You can click line numbers on Github to link directly to a specific line of sourcecode)

If I comment this line then the cropping is not square :

1 Like

Actually, if I crop the image the image cropping happens equally in all the directions. I need it to crop in one direction only. Like if I drag to crop from down then only height shoud change and if I drag to crop from left then only width should change.

From what I understood this only starts the cropping UI where you then can choose the area of the image to crop, doesn’t it?

Can you create a simple demo app for this plugin using ionic start cropExample blank and put it on Github?