My main reason to restart using B4A was to implement on a mobile device my mapping program which covers the entire UK at various scales and requires the ability to display large map images at a specified zoom level and centered on a specified coordinate and then allow the user to drag and zoom...
Q: I want to load a 10,000 x 10,000 image? A: That's impossible!!! The memory required is: width * height * 4 = 400MB. A: You will need to scale down the image. A: Sure. Use HugeImageView: (image source: https://images4.alphacoders.com/655/655004.jpg) How does it work? It uses two layers -...
www.b4x.com
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.
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)
My main reason to restart using B4A was to implement on a mobile device my mapping program which covers the entire UK at various scales and requires the ability to display large map images at a specified zoom level and centered on a specified coordinate and then allow the user to drag and zoom...
Q: I want to load a 10,000 x 10,000 image? A: That's impossible!!! The memory required is: width * height * 4 = 400MB. A: You will need to scale down the image. A: Sure. Use HugeImageView: (image source: https://images4.alphacoders.com/655/655004.jpg) How does it work? It uses two layers -...
www.b4x.com
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.
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.