tags:

views:

381

answers:

1

Hi,

I have an application that let's users view images. The user decides what images to use, so the size can range from 10x10 to 10000000x10000000 (I am exeggerating). All is well up to a certain size, when the image is bigger than the iPhone's memory. Quite understandably.

But how do I fix it? Is there a way to load only a portion of the image (I'm using an CATiledLayer, so I could load/release tile by tile).

Thanks in advance!

A: 

Unless you have an uncompressed image format it would be very hard to load the image in patches, you will have to provide the patches that the user would load, determine what portion of the image to show, and load the correct patches. There is an example for this "ScrollViewSuite" that demonstrate that technique. But this technique does require a preprocessing step.

Harald Scheirich
I recon it wouldn't be possible to do this on the iPhone, or is it?
Jongsma
Depends what you mean by "do this on the iPhone". The description of your app is a little bit vague. If you store the images on the phone then you can as well prepare the tiles. If you store the images on a server the you would have to make your server serve the tiles as opposed to a whole image
Harald Scheirich
I'm sorry for being vague. The images come from the iPhone's photo library. I wonder whether it would be possible to create the tiles on the iPhone. Wouldn't drawing the image tiles overflow the memory?
Jongsma
No to create the tiles you would either have to load the whole image into memory, which is what you are trying to prevent, or have them in a format where you can determine the location of a pixel in the file from its location on the screen, which you can't easily with JPG (i don't know if you can at all)
Harald Scheirich