uCrop icon indicating copy to clipboard operation
uCrop copied to clipboard

Same Input & Output With Different Settings

Open myalcinkuru opened this issue 3 years ago • 0 comments

Do you want to request a feature or report a bug? It's a bug not a feature :)

What is the current behavior?

Result images are appears 90 degree rotated in imageview.

What is the expected behavior?

It should fix the orientation issue of Android as it fixes when the image is cropped.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  • setMaxBitmapSize
  • start activity
  • don't change anything on screen (if you change bug won't occur)
  • press done and see result in imageview Note: This bug happens bcz of Android devices orientation issue. So it wont happen in all devices.I use samsung A7.

Please attach any image files, URL and stack trace that can be used to reproduce the bug.

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.4 (same 2.2.5) Test Android Api Version = 26

I think, it wasn't working in previous versions.

As i observed that uCrop won't make any changes if given file same as provided options. Below snippet proves that

` boolean shouldCrop = shouldCrop(mCroppedImageWidth, mCroppedImageHeight); if (shouldCrop) { ExifInterface originalExif = new ExifInterface(mImageInputPath); saveImage(Bitmap.createBitmap(mViewBitmap, cropOffsetX, cropOffsetY, mCroppedImageWidth, mCroppedImageHeight)); if (mCompressFormat.equals(Bitmap.CompressFormat.JPEG)) { ImageHeaderParser.copyExif(originalExif, mCroppedImageWidth, mCroppedImageHeight, mImageOutputPath); } return true; } else { FileUtils.copyFile(mImageInputPath, mImageOutputPath); return false; }

private boolean shouldCrop(int width, int height) { int pixelError = 1; pixelError += Math.round(Math.max(width, height) / 1000f); return (mMaxResultImageSizeX > 0 && mMaxResultImageSizeY > 0) || Math.abs(mCropRect.left - mCurrentImageRect.left) > pixelError || Math.abs(mCropRect.top - mCurrentImageRect.top) > pixelError || Math.abs(mCropRect.bottom - mCurrentImageRect.bottom) > pixelError || Math.abs(mCropRect.right - mCurrentImageRect.right) > pixelError || mCurrentAngle != 0; } ` This code taken from uCrop's BitmapCropTask class.

1- If shouldCrop return true, it just copies the file. So what if orientation is wrong ? 2- shouldCrop method doesn't return true even i set setMaxBitmapSize. That means my image size same as given if no cropping happens.

myalcinkuru avatar Feb 19 '21 08:02 myalcinkuru