Yalantis / uCrop

Image Cropping Library for Android

Home Page:https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crop window reset when image is rotated.

shgrg1712 opened this issue · comments

Do you want to request a feature or report a bug?
Feature
What is the current behavior?
First Issue : On Image rotate, image is getting zoom in to fit the dimensions of crop window. But on rotate back to original image orientation,Image still in Zoom in mode. So fix this issue set the scale multiplier to 1.0001f.
Pre-Condition : Set Scale multiplier to 1.0001f to avoid image scaling/zoom while rotation.
When we rotate an image with rectangular dimensions then crop window is not getting adjusted based on new dimensions of image after rotation
What is the expected behavior?
Pre-Condition : Set Scale multiplier to 1.0001f to avoid image scaling/zoom while rotation.
When we rotate an image with rectangular dimensions then crop window should get adjusted based on new dimensions of image after rotation.
In whatsapp on crop window, if we rotate the image then it rotate the crop window with image.
So image should not get scale on rotation rather crop window should get adjusted as per dimensions of image after rotation
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Pre-Condition : Set Scale multiplier to 1.0001f to avoid image scaling/zoom while rotation.
Steps

  1. Open one image from gallery.
  2. Rotate the image 90 degrees
  3. When crop window is out of image bounds then press the tick or ok button at top.

Observe: Crop failure error.
Please attach any image files, URL and stack trace that can be used to reproduce the bug.
Test_Image

**Which versions of uCrop, and which Android API versions are affected by this issue? Did this work in previous versions of uCrop?
UCrop Version : 2.2.8
Android Target SDK 34

These are the parameters set to launch UCropFragment

// Set the source image URI (file path or content URI)
uCropBundle.putParcelable(UCrop.EXTRA_INPUT_URI, sourceUri);
// Set the destination image URI (where the cropped image will be saved)
uCropBundle.putParcelable(UCrop.EXTRA_OUTPUT_URI, destinationUri);
// Set the UCrop.Options in the Bundle
uCropBundle.putInt(UCrop.Options.EXTRA_COMPRESSION_QUALITY, 100);
uCropBundle.putBoolean(UCrop.Options.EXTRA_FREE_STYLE_CROP, true);
uCropBundle.putBoolean(UCrop.Options.EXTRA_HIDE_BOTTOM_CONTROLS, false);
uCropBundle.putFloat(UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, 1.0001f);
uCropBundle.putIntArray(UCrop.Options.EXTRA_ALLOWED_GESTURES,new int[]{UCropActivity.ROTATE, UCropActivity.SCALE});
uCropBundle.putInt(UCrop.Options.EXTRA_UCROP_COLOR_CONTROLS_WIDGET_ACTIVE, mActivity.getColor(R.color.colorPrimary));
uCropBundle.putFloat(UCrop.EXTRA_ASPECT_RATIO_X,0);
uCropBundle.putFloat(UCrop.EXTRA_ASPECT_RATIO_Y,0);