Quote:
Originally Posted by Norbert
Our Xcode project holds a large image (.gif, about 4700x3100 pixels, 6MB). The file cannot be made smaller because we need this resolution.
|
No, you don't need this resolution. The phone can't display an image larger than 480x320, since that is the size of the screen. The best way to fix your problem is by breaking it into tiles no larger than 480x320, and then drawing the tiles that would be visible at any given time.
Right now your image would consume over 58 million bytes of memory on the phone once it has been decompressed, which is neeed to make it displayable. The 6MB size you quote is the compressed size (GIFs are compressed), UIKit needs to decompress the GIF into RGBA (GIFs can have transparency) in order to diplay on screen. 4700*3100*4(RGBA) = 58,280,000.
By tiling it into 480x320 segments, you would never need more than 4 segments loaded at a time, or 2.4MB of memory (480*320*4*4) = 2,457,600. If the image doesn't need to be transparent and you switch it to a PNG you could get that down to 1.8MB. And depending on the particulars of your application you could get it down a bit more.