Crop image in irregular shape

I need to crop the image in irregular shape, my application, i.e. I select the part with my finger, and if I press the crop button, the selected part by itself in the image will be saved in the SDCard.

How to do it?

+4
source share
2 answers

You need to define a Path for the shape you want to cut.
Then create a rectangle around it, set everything between your shape to a rectangle in transparent (alpha channel)

This source should give you some tips:
https://github.com/lvillani/android-cropimage/blob/develop/src/com/android/camera/CropImage.java
Take a look at the onSaveClicked method, line 209

+2
source

Refer to this project: https://github.com/coderush/FlexiCrop

It has a code for cropping irregular shapes.

0
source

All Articles