Maximum size of a element

后端 未结 14 1769
粉色の甜心
粉色の甜心 2020-11-22 07:34

I\'m working with a canvas element with a height of 600 to 1000 pixels and a width of several tens or hundreds of thousands of pixels. However, aft

14条回答
  •  礼貌的吻别
    2020-11-22 08:07

    To expand a bit on @FredericCharette answer: As per safari's content guide under section "Know iOS Resource Limits":

    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

    Therefore, any size variation of 5242880 (5 x 1024 x 1024) pixels will work on large memory devices, otherwise it's 3145728 pixels.

    Example for 5 megapixel canvas (width x height):

    Any total <= 5242880
    --------------------
    5 x 1048576 ~= 5MP   (1048576 = 1024 x 1024)
    50 x 104857 ~= 5MP
    500 x 10485 ~= 5MP
    

    and so on..

    The largest SQUARE canvases are ("MiB" = 1024x1024 Bytes):

    device < 256 MiB   device >= 256 MiB   iPhone 6 [not confirmed]
    -----------------  -----------------   ---------------------
    <= 3145728 pixels  <= 5242880 pixels   <= 16 x 1024 x 1024 p
    1773 x 1773        2289 x 2289         4096 x 4096
    

提交回复
热议问题