B4A Library ashImageZoom library

this is the first time for me to upload a library, hope i'm doing it in the right section of the complex..
i spent some time here looking (and testing) for a zoomable ImageView that behaves like an image in a WebView and like image display in samsung (and others) default gallery applications.
i checked the first 2 i've found (there's more) and was disappointed to find that they don't follow that behavior.
the problem is not in the zoom function. it's the behavior in the dragging. in the libs i've tested, the image can be dragged beyond its borders and can almost leave the container...

so i wrote what i needed. i'm sure it's not perfect, but at least, as for the above dragging issue it behaves exactly as an image in a WebView and as in my samsung default gallery app.

i've tried to upload with the demo, 2 huge 5184x3456 pixels images to demonstrate the coping with big images. well, i've learned that's such upload is not possible here.

the library depends on Informatix's Gesture Detector Library .

i want to thank Erel for the following insight i've found.
 

Attachments

  • ashImageZoom_Demo.zip
    453.7 KB · Views: 318
  • ashImageZoom_Library_ver1.2.zip
    7.3 KB · Views: 299

agraham

Expert
Licensed User
Longtime User
Out of interest what was wrong with this one? It has a PanLimit property and can display and zoom really large images as it incrementally decodes them.
ScaleImageView - Pan and zoom large images | B4X Programming Forum

I'm afraid your library crashes on a really large image(17408x 17408) as it seems to try to draw the entire image onto a canvas.
java.lang.RuntimeException: Canvas: trying to draw too large(1212153856bytes) bitmap.
 
Last edited:

a n g l o

Active Member
Licensed User
Longtime User
thanks.
Out of interest where exactly i wrote that something was wrong with that one ?

there is no canvas in my lib.

the largest jpg file i checked was 8000x8000 pixels (about 190 mb jpg....) without error.

i guess 17000x17000 is close to 1Gb jpg file....i wont even get into creating that file for test.
 

agraham

Expert
Licensed User
Longtime User
Out of interest where exactly i wrote that something was wrong with that one ?
You didn't - read 'wrong' as shorthand for 'didn't satisfy your need' which was my intended meaning.

there is no canvas in my lib.
Not directly in your library maybe but you are using Bitmap.LoadBitmap to get the image for an ImageView which uses an underlying Canvas and so hits the limitations that I observed in my post that I linked to above, as you can see from the error message.

i guess 17000x17000 is close to 1Gb jpg file
107,493KB actually. :) I use bigger jpg map images, up to 25,000 x 20,000, which is the maximum 64bit Windows can generate with either GDI+ or WPF as the decoding hits the 64bit integer size limits. :( ScaleImageView displays these fine on Android though a high performance phone is preferable to minimise the delays the incremental decoding causes when panning.
 
Last edited:

a n g l o

Active Member
Licensed User
Longtime User
agraham, thanks for the map.
issue fixed for such map (17000x17000) dimensions.
updated the library zip above to version 1.1 .

01.jpg
btw, on the right device it was working before the fix as well (although it's a pretty old device with old android version).
 

a n g l o

Active Member
Licensed User
Longtime User
i'm using winrar but rar is not uploadable here => change the ext.
well you have to open a new complain....as your first one was about crashing. That is really fixed (for now).
now you talking quality.
i'm sure that the zoomed map is much better displayed using your lib that was probably designed for that.
 

a n g l o

Active Member
Licensed User
Longtime User
lib updated to ver 1.2
increase quality for images that are not street maps (if there are such images in the world at all).
 
Top