image size limit on iPad?

2019-08-12 16:20发布

问题:

I develop a web-app and noticed that my zoom function is not working for some pictures and realized that apprently some pictures are resized. Check out these examples (tested on iPad2):

http://zoom-test.magent-server.de/bild1.html -> picture in gif-format shown in full size

http://zoom-test.magent-server.de/bild2.html -> picture in jpg-format originally in the same size, but reduced on iPad

I can't figure out when a picture is reduced. Apparently with gif it does not happen but also not always with jpg. It also does not depend on the image size or resoultion. I tested images with smaller and bigger sizes than those in the examples, but I couldn't find a pattern.

Is there any way to prevent image size reduction? Or at least a defintion so I know which pictures will be reduced and which not.

回答1:

There is a Limit of about 6,5 MB for a image to load (e.g. if you have 20 of them on a page) see here

but in your case, file size is not the problem, you should have a look at the apple docs where it says 'Know iOS Resource Limits'



回答2:

Because of the memory available on iOS, there are limits on the number of resources it can process:

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. The height and width of a canvas object is 150 x 300 pixels if not specified.

JavaScript execution time is limited to 10 seconds for each top-level entry point. If your script executes for more than 10 seconds, Safari on iOS stops executing the script at a random place in your code, so unintended consequences may result.

This limit is imposed because JavaScript execution may cause the main thread to block, so when scripts are running, the user is not able to interact with the webpage.

See the Safari Web Inspector Guide for how to debug JavaScript on iOS.

The maximum number of documents that can be open at once is eight on iPhone and nine on iPad.