Last week I published version 1.0.0 of android-crop – a simple image cropping library for Android.
This library began as a replacement for a fork of an unmaintained project that we were using at SoundCloud. It hadn’t been getting much love, and most importantly for me, the UI looked really dated.
Image cropping is not a major feature in our app, but it’s a useful part of the recording and sign-up flows. Leaning on a library for this functionality keeps our project focused.
The library aims to provide:
- Gradle build
- Modern UI
- Simple builder interface for crop Intent
- Example project
The following snippet starts a crop, loading the image in the library UI and saving the cropped version to the specified URI. This example also includes an aspect ratio option, which specifies that the output should be square.
Crop.of(inputUri, outputUri) .asSquare() .start(activity);
The image cropping logic itself comes from the AOSP camera code and is largely unchanged. Find the full source and documentation on GitHub.