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

Bitmap too large~ #121

Closed ikkyu0319 closed 7 years ago

ikkyu0319 commented 8 years ago

`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)`

shliama commented 8 years ago

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

ufosaga commented 8 years ago

Any update on this?

shliama commented 8 years ago

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.

ufosaga commented 8 years ago

@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

ufosaga commented 8 years ago

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

swepthong commented 8 years ago

android:hardwareAccelerated="false"

or

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

ufosaga commented 8 years ago

@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);
}
iielse commented 8 years ago

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

compile 'com.yalantis:ucrop:2.1.2'

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

this is useful

pit1 commented 8 years ago

X

milan-milojevic commented 8 years ago

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

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'