Android Question Problem cropping image with large resolution size

PumaCyan

Member
Licensed User
I apply take a photo from gallery then crop it

i use method and library from this : xResizeAndCrop

but there is a problem when the image size is large..
how to solve this?


bug2.png


 
Solution
The canvas size limitation varies with the Android version. Displaying large images has been a problem so I created ScaleImageView
Erel created a cross platform HugeImageView

LoadBitmapResize will let you load a reduced size image but I don't know of a way to crop a large image at the full resolution.

LucaMs

Expert
Licensed User
Longtime User
Based on the error (which you should ALWAYS post as TEXT as it its text!) you are requesting a bitmap size of 172mb.
Since this could happen even with less "heavy" images, if the smartphone memory is not enough, I suppose that some types of operations should be written inside a Try-End Try block (otherwise it would be necessary to detect the available memory and the maximum allowed by the operation which, if I'm not mistaken, concerns the canvases, not the normal loading in an ImageView)
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The canvas size limitation varies with the Android version. Displaying large images has been a problem so I created ScaleImageView
Erel created a cross platform HugeImageView

LoadBitmapResize will let you load a reduced size image but I don't know of a way to crop a large image at the full resolution.
 
Upvote 1
Solution

PumaCyan

Member
Licensed User
thanks to everyone who helped answer...
currently, the solution I can use is to use LoadBitmapResize, and it works fine... :)
 
Upvote 0

kimstudio

Active Member
Licensed User
Longtime User
It is interesting to know whether the error only happens at loading or at drawing. If it could be loaded then it is possible to draw part of the image and crop box on the limited size canvas and crop image in memory without losing image quality due to loadresize, or loadresize and draw fullscreen image then remap back cropbox to real size and crop in memory.
 
Upvote 0
Top