Search code examples
htmlweb-applicationsjpegw3c

HTML and displaying of <img/> element


I am trying to understand whether or not the web allow for viewing of progressive JPEG or not.

Assume we have a server where (see progressive jpegs):

$ identify /var/www/test.jpg
/var/www/test.jpg JPEG 2048x1080 2048x1080+0+0 8-bit DirectClass 129KB 0.020u 0:00.019
$ identify -verbose /var/www/test.jpg | grep Inter
  Interlace: JPEG

now if we place the following HTML document:

$ cat /var/www/test.html
<!DOCTYPE html>
<html>
<head><title>jpg test</title></head>
<body>
<p><img src="test.jpg" width="256" height="128"></p>
</body>
</html>

I am trying to understand whether or not (according to img element), a user agent is required to download the whole 2048x1080 image, while rendering region is only 256x128.

Or on the contrary a User Agent, is allowed to take into account the rendering region: 256x128, and therefore deduce it can only process a portion of the progressive JPEG. Knowing that there is no point in having the full resolution since it will not add any details to the image (well technically a quality layer should impact even at low resolution, this is just for simplification).

Typically, I'd like to know within an application such as google maps, if a User Agent can abort (suspend?) retrieval of currently displayed images, since User decide to zoom in some more based only on partial result from decompressing a progressive JPEG (the whole JPEG is not yet on User side).


Update: It turns out that web is trying a different approach here with the loading attribute in HTML:

<img src="example.jpg" loading="lazy" alt="example" />

Solution

  • Just discovered related proposals at:

    and a framework: