5

I'm developing a website which contains, by its nature, very large images. When testing on an iPad, I'm noticing that any image on the page larger than 2MB is not showing up, just showing the dreaded blue '?' instead. The only reason I can think of is that there is some sort of built-in resource size limit.

I've tried Googling, but there doesn't appear to be any published limit, and the only reports I've found mention 6.5MB... but I'm way below that.

Does anyone have any concrete sources that indicate if this limit exists, and what it may be?

1
  • To anyone else who is searching for this info: File size does not matter - because in memory, the image must be decompressed - any limits are based on pixel dimensions (width x height in pixels). "6 MP" (megapixels) is different than "6 MB" (megabytes). Mar 2, 2017 at 0:24

1 Answer 1

10

This official article what you are looking for. As expected there is no file size limit, the answer is more complex and depends on the device memory and image compression algorithm used:

  • The maximum size for decoded GIF, PNG, and TIFF images is 3 megapixels for devices with less than 256 MB RAM and 5 megapixels for devices with greater or equal than 256 MB RAM. That is, ensure that width * height ≤ 3 * 1024 * 1024 for devices with less than 256 MB RAM. Note that the decoded size is far larger than the encoded size of an image.

  • The maximum decoded image size for JPEG is 32 megapixels using subsampling. JPEG images can be up to 32 megapixels due to subsampling, which allows JPEG images to decode to a size that has one sixteenth the number of pixels. JPEG images larger than 2 megapixels are subsampled—that is, decoded to a reduced size. JPEG subsampling allows the user to view images from the latest digital cameras.

  • The maximum size for a canvas element is 3 megapixels for devices with less than 256 MB RAM and 5 megapixels for devices with greater or equal than 256 MB RAM.

4
  • Wow, you fully deserve a necromancer badge for this answer, my question is nearly a year old :) Thanks a lot! Mar 25, 2012 at 20:47
  • 1
    This is now incorrect even for old iPhone4 in simulator, and old iPad Air, and probably others. Try it - even a huge 5760x3600 pixel (20megapx) png background shows up on iOS.
    – NoBugs
    Jun 27, 2016 at 22:35
  • @NoBugs - which demonstrates you should not trust results from emulator, and test on actual devices - especially if need to support older devices. But yes, newer devices, iPhone 6 and 7, handle larger images - 16 Megapixel was mentioned in one comment elsewhere - and so does the emulator now. Would be interesting to know if iPhone 6 can handle that 20 MP background. Mar 2, 2017 at 0:19
  • @ToolmakerSteve I think I had tested large images a testing ipad that was >3yr old too... have you actually tested on an iPhone and found an image size it would not show?
    – NoBugs
    Mar 2, 2017 at 2:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .