I need to display a large image (3000x2000) with zoom and swipe gestures. Image is a map, so the key is performance and fluid motion.
Is there any control or library that does this well that I can use?
you can use
https://github.com/davemorrissey/subsampling-scale-image-view
which is able to load very large resolution images and also support scaling by gestures.
Related
I want to display set of images in horizontal viewpager.
I have used the "chrisbanes PhotoView" library.
Everything is working well but after zooming any image the quality of images getting lose even for high resolution images.
The Size of image is 1440*2560
Please let me know, if I am missing something
Thanks you in advanced
Actually I'm using android-svg library to display SVG files in ImageView. For scrolling and scaling on this image I used calculated values on matrix.postTranslate() and matrix.postScale() and it works fine, but every time when I update matrix it trigger onDraw() method which render whole SVG for this operation. Those SVG files are very big and scrolling with scaling are not smooth if every event trigger rendering again. I want to render this file once and just change viewport for user when scrolling or zooming image. Is it even possible ? If it's then how to achieve it ?
Thanks for any help.
I have a image (resolution 8328x3987). And I want to load that image in my app with zoom controls for better viewing.
As we all know that Android will not load large images directly on device (like in my example). So Android system suggested us to scale down the image to load large images. I have tried this and scale my image upto four times as:
options.inSampleSize = 4;
Using this way my image will displayed on screen, but when I zoom-in the image then this image becomes unreadable (text becomes very blurry), this is because, maybe I scale down the image before showing?
But when I see that image in to device's default gallery app (Android Lollipop, Photos app), then this image looks like a mapview (only visible portion is readable and outside is blurry, and when I move the image then visible area becomes readable) when I zoomed in at max level. So my questions is:
Is Android lollipop added any new way to load large files that looks like mapview?
If not, then do you have an idea how that apps do this or any example?
Reducing the sample size of an image that big will not work at all.(very very bad resolution and memory consumption)
I suggest you to divide image to tiles and recycle the views just like map views do.
This library may help you. Or you can do it your way too.
I have multiple large images and I would like to use these in such a way that it would allow users to do continuous panning. I couldn't stitch all the images into one image as it would give memory limit error. Also I want to compress the images. I believe one option is to place the images in a virtual grid shape and show image based on current viewport & touch position (it might have some issues when switching between images). I was wondering if there is any other easy ways to solve this.
You can split the images into smaller ones and load only the images currently visible on the screen and probably the next one to provide smoothness while panning. So if you have 6000x4000 you may want to automatically split them into 24 images 1000x1000.
I have some large images that I would like to display to the user. I want them to have the ability to zoom in. I am currently using TouchImageView, and it is working, however, the quality/resolution of the image does not change as I zoom in.
I noticed that some of the Gallery apps appear to be doing this. They load the entire image, at some sampling rate so that it can be displayed without an out of memory. Then as you zoom in, it appears that the quality of the image is getting increased.
Is there example code/library for functionality similar to this?
If you have 1 source image and are zooming in on it you aren't going to magically create resolution where there was none previously. The answer is to either create multiple r-sets or multiple images with different resolutions and load/zoom/scale dynamically, OR downsample the image yourself when displaying it zoomed out at a lower resolution.
For example, consider thumbnail images. They are created as a small sample of the original image. If you zoomed in on that thumbnail it would look horrible. You calculate the best r-set image based on the zoom level and coordinates of your client view.
I think my preference would be to preprocess the large images and create different levels of resolution as I mentioned in the first paragraph. Then as the user zooms in you load a different image. This is similar to how Google maps works for example.
I hope this helps.
I suggest that you use the view provided by Dave Morrissey:
Subsampling Scale Image View
An excerpt from the source:
A custom ImageView for Android with pinch to zoom and subsampled tiles
to support large images. While zooming in, the low resolution, full
size base layer is overlaid with smaller tiles in the best resolution
for the current scale, and tiles are loaded and discarded during
panning to avoid holding too much bitmap data in memory.