Love the concept of this project. I tried it out, using both the simulator and an iphone 4s, and it worked great. I then tried it with a very high resolution image, download from here: http://web.canon.jp/imaging/eosd/samples/eos5dmk3/downloads/01.jpg
Adding the image to the project, and adding it to the ImageData plist, and cleaning, however, did not work. It kept Sigaborting on TiledImageBuilder line 321. I don't know if this is an underlying limitation of the OS, or something else.
I just posted v1.8 to address the iPad crash.
On closiing, one last issue with " I think a great feature for enhanced perceived performance might be to incrementally tile, so that the visible tiles are displayed and can be interacted with immediately, while the higher res tiles continue to be created in the background". Actually, the high res tiles the the ones immediately generated and the smaller image tiles get generated at a slower rate (but there are fewer). While its possible to show the tiles as they arrive, the processor is going at like 100% while the downloading and tiling is going on, so users would have a bad experience actually trying to do something with the scroll view then,.
What I do in my real code is prefetch a small image, throw that into a UIImageView, and show that while the big images download. Once I have everything in place I fade the UIImage out and the new TiledView in (with no apparent change to the user). Its really nice and gives user something to do. Since the UIImageView has read the image into memory there is no jerkiness if you scroll or browse those images.
The processor going at full throttle makes sense. A separate thread could be spawned, but this might slow down tiling overall. You mention in your "real code" that you prefetch a smaller image. Is this a thumbnail of sorts that is created in advance? One thing I was curious about in terms of networked images was the possibility of loading a thumbnail or preview image from a larger file, without having to use pre-created thumbnails. The use case I have is, for instance, an 8 megapixel image on a server. It would be incredible to be able to fetch a smaller resolution version for preview, while downloading the full image in the background. Locally, APIs such as CGImageSourceCreateThumbnailAtIndex exist to do such a thing, but I've not seen anything that could do this over the network.
Q: You mention in your "real code" that you prefetch a smaller image. Is this a thumbnail of sorts that is created in advance?
A: Well, effectively. The smaller image is fetched early on to hold in reserve (since its quite small).
Q: Network scaling etc
A: At my last company we did this and it worked great. You combine a dynamic image server with a cache system. Essentially the requester adds parameters to a http get with the desired width, height, and quality (for jpeg). Software on the backend then looks first in the cache, and if not there, does the scaling on the backend then returns the image. The highly acclaimed ImageMagik can be gotten as a Python library (or you can just use the command line functions) to do this.
Revisiting this after a while...very impressed. If you don't mind my ignorance, I wanted to make sure I understand how this code works. Since as far as I know there is no way of getting an arbitrary "tile" of a jpeg--CGImageSourceCreateIncremental is creating a strip, correct? So what you are doing is loading a "full" image, at various resolutions, and then chopping these up in to tiles/rectangles? Or are you somehow actually pulling only an arbitrary rectangle into memory?
Got it. Thanks for the explanation. I'm considering using this or a similar technique dealing with ALAssets sourced locally. What I've seen so far is that the full resolution image, when scaled down, looks aliased. A full-screen res image looks better, but then swapping it out for the full res image when zooming in can reduce scrolling/zooming performance.
There's no issue right now with images sourced from an iDevice taking up too much memory at full res, but yours could be a good technique for future-proofing as long as there aren't any stability issues.
This is open source. I support it when I have the time, and there is always latency. I could get hit by a bus tomorrow then its yours (but I sure hope not!). What I've really been mulling on is whether I could use progressive jpegs to show the first, scaled down image, faster. This has been the biggest complaint. That said, you'd have to have control over your web images. However, progressively formatted images are not all that much different in size than "normal" ones, and for browsers etc should show the same.
Sorry, when I said "What I've seen so far is that the full resolution image looks aliased" etc. I mean my current work NOT using your library. I was trying to say I thought this library could be a potential solution to zooming images that weren't necessarily super high res, but typical 8mp iphone images.