BitMap size limitations

mskeels

Member
Licensed User
Hi,all, Newb here.

I am playing with the TouchImageView Demo and trying to load various jpg files. These are mostly A size drawings but I need a fairly good resolution so that a machinist can read these prints on a 10" tablet.

This is the first time I have experimented with images in my app.

I note that only small images (for example <= 150 dpi horizontal and vertical and 24 - 32 Jpeg quality) will load.

Actually, 150 dpi is probably fine given a reasonably high quality of image to start with.


  • Where can I learn more about the image capabilities of the BitMap object?

  • How do I determine what is the maximum image size/resolution I can use?

  • How can I determine what kinds of images I can load?

Thank you all,
Mark
 

mskeels

Member
Licensed User
Ok, so I can use

B4X:
   Bitmap1.InitializeSample(File.DirAssets, "test72.jpg",Activity.Width, Activity.Height)

I guess that's the answer. I'll convert my pdf's to jpg's.

Viewing is not as "crisp" as a pdf viewer, but I need to view the drawings within my app.

I suppose there is no way to get some kind of graphics format that would preserve the higher resolution of the drawing appearance when viewing a pdf but still allow viewing within the app?

Thanks,
Mark
 
Upvote 0

warwound

Expert
Licensed User
Two points:

1) If you are running into out of memory errors with large Bitmaps then there is the possibility of updating the manifest file with a largeHeap attribute.
That will force the device to allocate a larger memory heap space to your app and you can then in theory load larger Bitmaps.
I used such a technique here to enable me to load larger images in a GroundOverlay.

Note that the format of the image that you load is not related to the amount of memory that the image requires once loaded into your application.
A compressed JPG will require the same amount of memory in your application as an uncompressed .bmp bitmap image file.
(Assuming resolution and color depth etc are equal).

2) You could display very high quality images in your application by turning them into a custom tile overlay and displaying these tiles using OSMDroid MapView!
You'd start with the highest resolution and quality image available and create a set of map tiles. A series of tiles for every zoom layer that you want available in the MapView.
Package the tiles as an offline tile archive and then set an OSMDroid MapView to use the offline tile archive as a tile source.

As each tile is just 256 pixels square and just a handful of tiles will be loaded at any one time you can display very large and very high quality images with no memory problems.
The MapView would enable you to pan and zoom around your image, just as you can pan and zoom around a 'normal' map.

The MapView will only zoom to discrete zoom levels - for example you can display zoom level 4 and 5 but not zoom level 4.25, so that's a possible disadvantage.
Another disadvantage is that an offline tile archive will be quite a few MBs in size, size depending on the number of zoom levels you want to support and how much you compress the tiles.

Post again if you want more info on a custom tile layer solution.

Martin.
 
Upvote 0
Top