Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to interlace an image?

As a general rule of thumb when is it appropriate to make a gif interlaced, a png interlaced and a jpeg progressive?

Especially when publishing the image on the web.

like image 978
Timo Huovinen Avatar asked Nov 19 '12 07:11

Timo Huovinen


People also ask

Why would you use an interlaced image?

With an interlaced display the picture is created by scanning every other line, and on the next scan, scanning every opposite line. Interlacing allows for a faster refresh rate by having less information during each scan at a lower cost.

Should you interlace a PNG?

Standard PNGs have a perfectly acceptable progressive rendering solution without interlacing. They render in obvious and simple fashion, from top to bottom.

What is the difference between interlaced images and progressive images?

Difference Between Interlaced and Progressive Scan:Progressive-scan displays all lines at once. Interlaced-scan displays half of the lines at a time.

What is interlacing discuss its need?

Interlacing (also known as interleaving) is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image.


1 Answers

  • JPEG: YES — use progressive scan. It makes files smaller (each pass gets its own Huffman table), and partial rendering looks quite good.

  • GIF: NO — it's unlikely to make the file smaller, partial rendering is poor, and it's pointless for animGIFs. It's best not to use GIF at all (yes, even for anims).

  • PNG: NO — it hurts compression (as data from each pass is statistically quite different). If the image is large, use high-quality JPEG or lossy PNG if possible, as these may load quicker than a pixelated preview of a large lossless PNG.

ImageOptim will automatically change progressive/interlaced formats when it makes files smaller.


Disclaimers for nitpickers:

  • In case of small and medium-sized images the progressive preview of each image is not going to be visible long enough for the user to appreciate it. Some browsers don't even bother rendering anything until the whole file is downloaded, so it's better to focus on saving bandwidth to get the whole page loaded ASAP.
  • Non-progressive JPEG is a bit more efficient when the files are tiny (small thumbnails), but then the savings are tiny, too.
  • iOS Safari has a higher maximum allowed image size for baseline JPEG than progressive, but the right solution there is to serve images at sizes reasonable for mobile in the first place.
like image 151
Kornel Avatar answered Oct 08 '22 09:10

Kornel