naver / android-imagecropview

android image crop library
Apache License 2.0
254 stars 55 forks source link

Still unable to crop large Bitmap #7

Closed ragobus closed 8 years ago

ragobus commented 9 years ago

Still facing issues cropping large Bitmap,, it crashes and gives just line picture.

helloyako commented 9 years ago

@Whbcc Do you use ImageCropView.setImageFilePath() method?

helloyako commented 9 years ago

@Whbcc Did you read my comment? I think you use setImageBitmap() method. If App use hardwareAccelerated option in AndroidManifest, ImageView can't upload too large bitmap than texture size.

You may see this error message. Bitmap too large to be uploaded into a texture (2316x4632, max=4096x4096)

So, I add code that is throw exception when bitmap is lager than texture size.

If you need to use large bitmap, you should use setImageFilePath() method please.

Hope This Helps.

Thank you.

helloyako commented 9 years ago

I have done rollback throw exception code.

ragobus commented 9 years ago

Hi helloYako , been offline for a while.. Can you reopen the thread because am yet to solve the issues. Here is the breakdown of the error: Instead of cropping, it will only crop rectangular line image from the whole picture and also any file size limit for cropping? I used : imageCropView.setImageFilePath(uri.toString());

helloyako commented 9 years ago

@Whbcc this support only rectangular line. I don't limit file size. Do you have any problem?

ragobus commented 9 years ago

Yeah, i noticed the crashes are due to file size. above 10MB>>> mainly native camera images..

helloyako commented 9 years ago

@Whbcc What is your device and android version? When I try to use 16MB file, I don't have problem. Can I know crash log?

tmpg commented 8 years ago

I am getting an odd error, when I load a large image: it gives me this and displays a long rectangle:

02-27 11:30:05.751 10302-10353/com.yyyyyy.xxxxxxxxxxxxxxxxxxx D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1 02-27 11:30:05.891 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@1bc147a9 time:41524341 02-27 11:30:05.891 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@2a483940 time:41524341 02-27 11:30:06.141 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx V/ActivityThread﹕ updateVisibility : ActivityRecord{268c6ea6 token=android.os.BinderProxy@2a483940 {com.yyyyyy.xxxxxxxxxxxxxxxxxxx/com.yyyyyy.xxxxxxxxxxxxxxxxxxx.SignupActivityTwo}} show : false 02-27 11:30:06.901 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN 02-27 11:30:07.561 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc partial concurrent mark sweep GC freed 22(848B) AllocSpace objects, 1(20KB) LOS objects, 7% free, 197MB/213MB, paused 273us total 8.961ms 02-27 11:30:07.581 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc concurrent mark sweep GC freed 9(12KB) AllocSpace objects, 0(0B) LOS objects, 7% free, 197MB/213MB, paused 252us total 16.781ms 02-27 11:30:07.581 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Forcing collection of SoftReferences for 60MB allocation 02-27 11:30:07.601 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc concurrent mark sweep GC freed 11(352B) AllocSpace objects, 0(0B) LOS objects, 7% free, 197MB/213MB, paused 269us total 16.406ms 02-27 11:30:07.601 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx E/art﹕ Throwing OutOfMemoryError "Failed to allocate a 63489036 byte allocation with 16777120 free bytes and 58MB until OOM" 02-27 11:30:07.611 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc partial concurrent mark sweep GC freed 6(192B) AllocSpace objects, 0(0B) LOS objects, 7% free, 197MB/213MB, paused 308us total 10.831ms 02-27 11:30:07.631 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 7% free, 197MB/213MB, paused 330us total 20.599ms 02-27 11:30:07.641 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Forcing collection of SoftReferences for 60MB allocation 02-27 11:30:07.651 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx I/art﹕ Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 7% free, 197MB/213MB, paused 253us total 18.833ms 02-27 11:30:07.661 10302-10302/com.yyyyyy.xxxxxxxxxxxxxxxxxxx E/art﹕ Throwing OutOfMemoryError "Failed to allocate a 63489036 byte allocation with 16777120 free bytes and 58MB until OOM"

If it is a small image this is not an issue. How can I crop large images?

Thanks, Tmpg

helloyako commented 8 years ago

@tmpg Can you send me image? helloyako@gmail.com

tmpg commented 8 years ago

Here is the image I am getting an error on:

https://drive.google.com/file/d/0Bwa-JXbjFUDuYThVQTdtRlRVWWc/view?usp=docslist_api

Let me know what is going on?

Thanks Tmpg

helloyako commented 8 years ago

@tmpg

I have tested image that you give me.

But I can crop.

load https://drive.google.com/file/d/0B2-S-qsCc8MnTDByWGc4NDVMZkk/view?usp=sharing

save https://drive.google.com/file/d/0B2-S-qsCc8MnZHpyYi1rYlNHaE0/view?usp=sharing

result https://drive.google.com/file/d/0B2-S-qsCc8MnSFdHVlRYR0U3R1E/view?usp=sharing

I don't occur problem

tmpg commented 8 years ago

cropperActivity.txt

I am still getting the issue. Is there anything in my activity you see is wrong? =[

Many thanks, Tmpg

helloyako commented 8 years ago

@tmpg Do you occur issue in sample app?

https://github.com/naver/android-imagecropview/blob/master/apk/app-release.apk?raw=true

tmpg commented 8 years ago

Hey I tried it and I get this error:

02-29 02:10:18.471 31735-31735/com.naver.android.helloyako.imagecropsample E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.naver.android.helloyako.imagecropsample, PID: 31735 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=99, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:1416 flg=0x1 }} to activity {com.naver.android.helloyako.imagecropsample/com.naver.android.helloyako.imagecropsample.MainActivity}: java.lang.NullPointerException: uriString at android.app.ActivityThread.deliverResults(ActivityThread.java:4730) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4773) at android.app.ActivityThread.access$1500(ActivityThread.java:205) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6895) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by: java.lang.NullPointerException: uriString at android.net.Uri$StringUri.(Uri.java:471) at android.net.Uri$StringUri.(Uri.java:461) at android.net.Uri.parse(Uri.java:433) at com.naver.android.helloyako.imagecropsample.MainActivity.onActivityResult(MainActivity.java:108) at android.app.Activity.dispatchActivityResult(Activity.java:6758) at android.app.ActivityThread.deliverResults(ActivityThread.java:4726)             at android.app.ActivityThread.handleSendResult(ActivityThread.java:4773)             at android.app.ActivityThread.access$1500(ActivityThread.java:205)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:145)             at android.app.ActivityThread.main(ActivityThread.java:6895)             at java.lang.reflect.Method.invoke(Native Method)             at java.lang.reflect.Method.invoke(Method.java:372)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 02-29 02:10:18.781 3529-31818/? E/android.os.Debug﹕ ro.product_ship = true 02-29 02:10:18.781 3529-31818/? E/android.os.Debug﹕ ro.debug_level = 0x4f4c 02-29 02:10:18.811 4403-4403/? E/PeopleStripeProcessMonitor﹕ getTopActivity : MultiWindowFacade.taskList = []

I have a Galaxy s6 with android ver 5.1.1 api 22.

Does it work at this version?

Thanks, Tmpg

helloyako commented 8 years ago

@tmpg Maybe, you selected image from Recent. please, change to Gallery, then select image.

https://drive.google.com/file/d/0B2-S-qsCc8MnUF9idFZRaUNtcXc/view?usp=sharing