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

Bitmap too large~

ikkyu0319 opened this issue · comments

commented

`OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)
05-18 15:54:25.778 8210-8236/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)

05-18 15:54:25.779 8210-8236/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)

05-18 15:54:25.793 8210-8236/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)

05-18 15:54:25.794 8210-8236/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)

05-18 15:54:25.794 8210-8236/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)`

Thanks for the issue. I've added fix and it will be available soon in next library update :octocat:

Any update on this?

It should be fixed in 2.1.1. If you can reproduce it with the latest version, please attach image and device info so I can reproduce.

@shliama
Hi Oleksii,
I am using the ucrop top of tree cloning yesterday by:
git@github.com:Yalantis/uCrop.git
gradle.properties shows: VERSION_NAME=2.1.1

I am able to reprodue this issue with the sample(com.yalantis.ucrop.sample) on a M4 LTE device.
Here the image and device information:
Error logs:
....
07-16 09:38:43.354 19663-19855/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)
07-16 09:38:43.371 19663-19855/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)
07-16 09:38:43.388 19663-19855/com.yalantis.ucrop.sample W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3120x4160, max=4096x4096)
....


Oops, I have problem to upload the images to s3 (blocked by the Great Fire Wall of China), I'll have a try later...

mi4let
img20160703103145

@shliama are you able to reproduce using my test photo? Please let me know if I didn't using uCrop the right way.

android:hardwareAccelerated="false"

or

Canvas canvas = new Canvas();
if(canvas.getMaximumBitmapWidth() < bitmap.getWidth() ) {
cropView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
}

@swepthong
android:hardwareAccelerated="false" does can workaround this issue, but will largely impact the image op performance.
canvas cannot provide the correct gl texure extent limit. My modified version is:

if (bitmap.getWidth() > GL10.GL_MAX_TEXTURE_SIZE || bitmap.getHeight() > GL10.GL_MAX_TEXTURE_SIZE) {
    cv.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
commented

W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (4128x2322, max=4096x4096)

compile 'com.yalantis:ucrop:2.1.2'

commented
<activity
            android:name="com.yalantis.ucrop.UCropActivity"
            android:screenOrientation="portrait"
            android:hardwareAccelerated="false"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

this is useful

commented

X

The proper solution is to use UCrop.Options setMaxBitmapSize() to make sure the OpenGLRenderer texture pixel limit is not exceeded

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'