Search code examples
androidimageimage-processingimageviewcrop

Smart cropping for ImageViews in Android


I'm looking for an automatic croppping tool for ImageViews in Android, that would crop the image in ImageView in runtime in a content-aware way. This is also called Smart Crop or something. Here is an example for Javascript.

Is there a similar library with those smart crop algorythms implemented for Android ImageViews? The idea of how it should work:

  1. Getting the actual width-height of ImageView on the screen of the device in runtime.
  2. Smart-cropping of the original image (or setting the positioning of the image, as if it's in the background) in a content-aware way (like, center on faces)

Solution

  • If you are using picasso (glide or fresco). This library crop images detecting faces supported on google's vision service

    https://github.com/aryarohit07/PicassoFaceDetectionTransformation

    Edit:

    There is a library based on smartcrop.js here (smartcrop-android).
    I haven't used already, but looikng to the example times. I kind of lower. A plus, it supports Rx.