37939

Crop an Image in irregular shape

Question:

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.

How to achieve it?

Answer1:

You have to define a Path for the Shape you want to be cut out.<br /> 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:<br /><a href="https://github.com/lvillani/android-cropimage/blob/develop/src/com/android/camera/CropImage.java" rel="nofollow">https://github.com/lvillani/android-cropimage/blob/develop/src/com/android/camera/CropImage.java</a> <br />Take a look at the onSaveClicked method, line 209

Answer2:

Refer this project: <a href="https://github.com/coderush/FlexiCrop" rel="nofollow">https://github.com/coderush/FlexiCrop</a>

It has the code to crop irregular shapes.

Recommend

  • How to parse huge xml data from webservice in Android application? [closed]
  • Distinct Count across Bigquery arrays
  • Controlling the behavior of the Browsers Back Button
  • Get Skype voice notes in a bot
  • Double data-confirm prompt observed on rails with framework7
  • How to use jeromq in MATLAB
  • Don't understand rounding behavior in sql server when using division operator
  • why do serviceSubscriberCellularProviders return nil? (in iOS 12)
  • How to get internal link from latest revision of a wikipedia page?
  • Google API Level 18 emulator “This app won't run unless you update Google Play services”
  • Attach an event handler to a StopWatch
  • cq5 accessing osgi servlet through Url
  • how can i open a webpage in a webview from a fragment with buttons?
  • In Moment.js, how do you get the date of the next occurrence of a specific month (ex: 'next Jan
  • ClearCase can I use clearexport_ccase/clearimport to copy VOB data to a VOB on a different machine
  • Passing HTTP Post from AWS API GW to Lambda
  • Threads and Concurrent Modification Exception working with a list
  • How to implement Google Drive and Google Plus sdk in ios project
  • How to display youtube video on HTML page? [closed]
  • Query regarding com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is “ac:e
  • First dynamically-added TinyMCE editor displays, others do not
  • How to display converted time zones in a 'generic week' (Sunday thru Saturday)?
  • Javascript inside HTML import not affecting imported HTML
  • C# code can't “see” the methods in my C++ dll
  • Query takes almost two seconds but matches only two rows - why isn't the index helping?
  • Copy and paste data from multiple workbooks to a worksheet in another Workbook
  • Create an average of multiple excel chart without the data source
  • Is there a better way for handling SpatialPolygons that cross the antimeridian (date line)?
  • Cloud Code: Creating a Parse.File from URL
  • How to call jQuery function in HTML returned by AJAX
  • Android: Unable to detect vertical plane
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • How to warp text around image in iOS?
  • Debug `Unexpected end of JSON input Error` on content script
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Angular FormGroup won't update it's value immediately after patchValue or setValue