HUGE image to display on iPhone

Ok, here is my problem. I have a HUGE jpg file, size 18000 x 18000 pixels 41 MB. If you really need to know, this is a map of the country section with services.

My project is very simple. I just need to scale and display this grandfather sized image. All the way from aspect fits 100% on iPhone. I'm not too sure that this can be done or how long it will take. Would get acquainted with any information.

I tried using imageView, but I read that it really should exceed 1024 x 1024. This is much lower than what I have. If you have an idea how to do this, please share!

+4
source share
3 answers

You must divide the image into tiles with a range of magnification. Calculate and build these off-line and send them as separate files in the application bundle. Given the magnification of your display, select the closest zoom. Then you select which tiles are needed to cover the screen, and create a grid of them. When the user zooms in, select the appropriate tile size.

The advantage of this is that you never have to load HUGE files in memory, only as much as necessary.

This is what Google maps do.

I can not give you any code, sorry!

+16
source

You should follow an approach similar to what Google Maps and other sites do. You need to cut the entire map into sections, so users do not need to download the entire map if it is not always necessary (plus faster loading time)

There are several solutions that can work for you as OpenLayers or even create a custom Google map with your images, as shown here and here.

+2
source

Here is an example from Apple for processing large images called PhotoScroller . Images have already been tiled. If you need an example of splitting an image in Cocoa, select cimgf.com

+1
source

Source: https://habr.com/ru/post/1391467/


All Articles