Skip to content Skip to sidebar Skip to footer

Crop An Image In Irregular Shape

I need to crop an Image in irregular shape my app, i.e., I select a portion by finger and if I click crop button, the selected portion alone in the Image will be saved in SDCard. H

Solution 1:

You have to define a Path for the Shape you want to be cut out. Then create a rectangle around it an set everything between your shape an the rectangle to transparent (Alpha Channel)

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

Solution 2:

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

It has the code to crop irregular shapes.

Post a Comment for "Crop An Image In Irregular Shape"