0

I am creating a kind of 'map' in my app. This is basically only viewing an image with an imageView/scrollView. However, the image is huge. Like 20,000x15,000 px or something. How can I tile this image so that it fits? When the app tiles by itself, it uses way too much memory, and I want this to be done before the app I launched, and just include the tiled, not the original image. Can photoshop do this? I have not done a complete search for this yet, as I am away, and typing on an iPhone with limited network connection..

Sti
  • 8,275
  • 9
  • 62
  • 124

2 Answers2

2

Apple has a project called PhotoScroller. It supports panning and zooming of large images. However, it does this by pre-tiling the images - if you look in the project you will see hundreds of tiles for various zoom sizes. The project however does NOT come with any kind of tiling utility.

So what some people have done is create algorithms or code that anyone can use to create these tiles. I support an open source project PhotoScrollerNetwork that allows people to download huge jpegs from the network, tile them, then display them as PhotoScroller does, and while doing research for this I found several people who had posted tiling software.

I googled "PhotoScroller tiling utility" and got lots of hits, including one here on SO

Community
  • 1
  • 1
David H
  • 40,852
  • 12
  • 92
  • 138
  • 1
    I really like your PhotoScrollerNetwork, wonderful job! Any plans of updating it to a Pod? – Islam Jul 22 '17 at 19:29
  • @IslamQ. I don't. One big issue is that this project has several interrelated components, many of which don't have (or could have) Pods - for instance libjpegturbo has no pod (or didn't last time I looked). The demand for something like this project is low too - so the few who really need it will just have to work a bit harder. Interesting note: I did this project over a weekend - intending to use it in a company product - then company refused to create high detail images so it wasn't used (and thus I never used it in any of my own projects!) – David H Jul 23 '17 at 15:50
  • 1
    That's a pretty amazing job over a weekend! I'm working on an app for [APOD](https://apod.nasa.gov/) images and was planning to use your tool (and make the whole app open source). On top of the issues you mentioned, PSN is crashing when on turbo mode and trying to download from the Internet (it's kind of expected - it's a 3-y.o. project). I'd really appreciate if you could help me convert this tool to Swift and make it available through Pods so others can also benefit. – Islam Jul 23 '17 at 17:36
  • 1
    Just realized that it was crashing because the image didn't exist on your dropbox account. Tested with a valid link and it still works perfectly fine! – Islam Jul 23 '17 at 17:56
  • @IslamQ. Dropbox changed how public folders work - will fix this soon – David H Jul 23 '17 at 19:29
  • @IslamQ. Project (and links) updated - should now work as advertised. – David H Jul 23 '17 at 21:36
  • 1
    Thanks for that. I [forked your repo](https://github.com/qalandarov/PhotoScrollerNetwork/tree/feature/swift) and played with it for a few hours and created an initial version in Swift. The more I play with it the more I love your turbo version - the CG decoder has a memory spike while tiling, but the turbo versions don't - fantastic implementation! – Islam Jul 24 '17 at 18:29
0

CATiledLayer is one way to do it and of course the best if you can pre-tile the images downloading them from the internet (pay attention on how many connection you are going to open) or embedding them(increasing overall app size), the other is memory map the image on the file system (but an image with that res could take about 1GB), take a look at this question it could be an intersteing topic SO question about low memory scenario

Community
  • 1
  • 1
Andrea
  • 26,120
  • 10
  • 85
  • 131