@Override
  public Parcelable onSaveInstanceState() {
    if (mLoadedImageUri == null && mBitmap == null && mImageResource < 1) {
      return super.onSaveInstanceState();
    }

    Bundle bundle = new Bundle();
    Uri imageUri = mLoadedImageUri;
    if (mSaveBitmapToInstanceState && imageUri == null && mImageResource < 1) {
      mSaveInstanceStateBitmapUri =
          imageUri =
              BitmapUtils.writeTempStateStoreBitmap(
                  getContext(), mBitmap, mSaveInstanceStateBitmapUri);
    }
    if (imageUri != null && mBitmap != null) {
      String key = UUID.randomUUID().toString();
      BitmapUtils.mStateBitmap = new Pair<>(key, new WeakReference<>(mBitmap));
      bundle.putString("LOADED_IMAGE_STATE_BITMAP_KEY", key);
    }
    if (mBitmapLoadingWorkerTask != null) {
      BitmapLoadingWorkerTask task = mBitmapLoadingWorkerTask.get();
      if (task != null) {
        bundle.putParcelable("LOADING_IMAGE_URI", task.getUri());
      }
    }
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putParcelable("LOADED_IMAGE_URI", imageUri);
    bundle.putInt("LOADED_IMAGE_RESOURCE", mImageResource);
    bundle.putInt("LOADED_SAMPLE_SIZE", mLoadedSampleSize);
    bundle.putInt("DEGREES_ROTATED", mDegreesRotated);
    bundle.putParcelable("INITIAL_CROP_RECT", mCropOverlayView.getInitialCropWindowRect());

    BitmapUtils.RECT.set(mCropOverlayView.getCropWindowRect());

    mImageMatrix.invert(mImageInverseMatrix);
    mImageInverseMatrix.mapRect(BitmapUtils.RECT);

    bundle.putParcelable("CROP_WINDOW_RECT", BitmapUtils.RECT);
    bundle.putString("CROP_SHAPE", mCropOverlayView.getCropShape().name());
    bundle.putBoolean("CROP_AUTO_ZOOM_ENABLED", mAutoZoomEnabled);
    bundle.putInt("CROP_MAX_ZOOM", mMaxZoom);
    bundle.putBoolean("CROP_FLIP_HORIZONTALLY", mFlipHorizontally);
    bundle.putBoolean("CROP_FLIP_VERTICALLY", mFlipVertically);

    return bundle;
  }
Gets the cropped image based on the current crop window.<br>
If (reqWidth,reqHeight) is given AND image is loaded from URI cropping will try to use sample
size to fit in the requested width and height down-sampling if possible - optimization to get
best size to quality.<br>
The result will be invoked to listener set by {@link
#setOnCropImageCompleteListener(OnCropImageCompleteListener)}.

@param reqWidth the width to resize the cropped image to (see options)
@param reqHeight the height to resize the cropped image to (see options)
@param options the resize method to use on the cropped bitmap
@param saveUri optional: to save the cropped image to
@param saveCompressFormat if saveUri is given, the given compression will be used for saving
    the image
@param saveCompressQuality if saveUri is given, the given quality will be used for the
    compression.
core/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java