static BitmapSampled cropBitmapObjectHandleOOM(
      Bitmap bitmap,
      float[] points,
      int degreesRotated,
      boolean fixAspectRatio,
      int aspectRatioX,
      int aspectRatioY,
      boolean flipHorizontally,
      boolean flipVertically) {
    int scale = 1;
    while (true) {
      try {
        Bitmap cropBitmap =
            cropBitmapObjectWithScale(
                bitmap,
                points,
                degreesRotated,
                fixAspectRatio,
                aspectRatioX,
                aspectRatioY,
                1 / (float) scale,
                flipHorizontally,
                flipVertically);
        return new BitmapSampled(cropBitmap, scale);
      } catch (OutOfMemoryError e) {
        scale *= 2;
        if (scale > 8) {
          throw e;
        }
      }
    }
  }
Crop image bitmap from given bitmap using the given points in the original bitmap and the given
rotation.<br>
if the rotation is not 0,90,180 or 270 degrees then we must first crop a larger area of the
image that contains the requires rectangle, rotate and then crop again a sub rectangle.<br>
If crop fails due to OOM we scale the cropping image by 0.5 every time it fails until it is
small enough.
core/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java