Yalantis / uCrop

Image Cropping Library for Android
https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/
11.86k stars 2.16k forks source link

Image black in uCrop when starting intent with camera picture on S4 device #187

Closed peterhav closed 8 years ago

peterhav commented 8 years ago

I seem to have run into a bug. When I start the uCrop intent on a S4 device, the UI shows a completely black image on a S4 device when cropping a camera image. I have only seen this on a S4 (5.0.1) device. The app functions correctly on an emulator (Genymotion APIs 16 & 17) and on a S6 (Android 6.0, after asking for permissions). Running the exact same intent on the S4 with an image from the gallery works without problems. Even though the image is totally black, the crop/rotate functionality seems to work (the output looks fine).

Expected I expect an image to be visible at all times, or an error to be reported. A guess is that this is related to permissions; I do have a READ/WRITE EXTERNAL STORAGE in the manifest.

uCrop version used is 2.1.2. This is my first use of this library, so I'm not sure if this worked correctly in older versions.

milan-milojevic commented 8 years ago

try setting UCrop.Options setMaxBitmapSize() to something <= 4096 to make sure the OpenGLRenderer texture pixel limit is not exceeded. that should solve the issue.

peterhav commented 8 years ago

Thanks @milan-milojevic this has solved the problem!

shliama commented 8 years ago

Please check the latest uCrop version :octocat: Now you can choose between:

Lightweight general solution
compile 'com.yalantis:ucrop:2.2.0' 
Get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
compile 'com.yalantis:ucrop:2.2.0-native'
FTExplore commented 7 years ago

@milan-milojevic thanks, your method solve my problem ! Here's my opinion, I should set the MaxBitmapSize according to the phone? because different phone has different max opengl limit