Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No and no.</p> <p>It bears repeating: the size of an image file on disk can not be compared to the size of the image in memory as a <a href="http://en.wikipedia.org/wiki/Texture_mapping" rel="nofollow">texture</a>.</p> <p>For example, a <a href="http://en.wikipedia.org/wiki/Portable_Network_Graphics" rel="nofollow">PNG</a> file uses a losless compression whereas the same image as a <a href="http://en.wikipedia.org/wiki/Jpg" rel="nofollow">JPG</a> file uses lossy compression and therefore can be significantly smaller. But once loaded as a texture, both textures will use the same amount of memory because the <a href="http://en.wikipedia.org/wiki/Graphics_processing_unit" rel="nofollow">GPU</a> doesn't know what a PNG or JPG is, it can only work with the various texture formats the GPU supports and those formats don't happen to be any of the common image file formats because they serve very different purposes.</p> <p>Every image that should be displayed on screen needs to be loaded into a texture. Texture sizes are defined by a few properties: size, color &amp; alpha bith depth, and where supported: compression.</p> <p>As for compression, the only supported formats on iOS devices are <a href="http://en.wikipedia.org/wiki/PVRTC" rel="nofollow">PVRTC2 and PVRTC4</a> (the 2 and 4 stand for 2-Bit and 4-Bit but that's not comparable to actual color bit depth). Textures using this format use very little memory and render very fast, but you lose image quality and color vibrancy, in many cases just too much to be acceptable.</p> <p>That leaves you with the uncompressed formats, which are either 8-Bit, 16-Bit or 32-Bit textures. 8-Bit textures are only used for masking, tinting and other technical uses, they are essentially greyscale images. </p> <p>The gist of textures used in games and apps are either 16-Bit or 32-Bit. Meaning that per pixel in the texture you need either 2 Bytes or 4 Bytes of memory. A 1024x1024 texture with 32-Bit color-depth uses 1024x1024x4 = 4,194,304 Bytes or 4 Megabytes of memory, regardless of the image file size.</p> <p>Usually developers strive to use 16-Bit textures since that halves the memory usage and gives a slight performance boost. Unless the images uses gradients where the missing extra colors can become noticeable. For large images or fast-moving images PVR images can improve rendering performance and memory usage, but should only be used where the difference to uncompressed textures is hardly noticeable.</p> <p>Finally, UIImageView is not optimized for rendering speed, not in the least bit. If you plan to make a game based on UIImageView, you could as well shoot yourself in the foot - you'd actually save yourself some pain that way. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload