Re:Progressive JPEGs: a new best practice
by lysol on Saturday December 29, 2012 @06:23PM
(#4983878)
I'm nitpicking, but
This is easily avoided by defining the image dimensions in your stylesheet.
[ Parent
| on HN ]
Re:Progressive JPEGs: a new best practice
by sltkr on Saturday December 29, 2012 @07:35PM
(#4984029)
And when the dimensions aren't defined, then progressively encoded JPEGs don't offer an advantage either, because with both progressive and non-progressive images, browsers reserve space for images as soon as their size is known, i.e. when the file header is received.
Re:Progressive JPEGs: a new best practice
by aerobson on Sunday December 30, 2012 @10:31AM
(#4985926)
Agreed. But would you say that progressive jpegs don't offer a visual advantage in this case? Imagine if a photo has a caption below it: baseline starts rendering far away from the caption, but with progressive we'll get the caption in the correct place without a big gap between the caption and where the photo is rendering. In the case of baseline, the photo will draw to "meet" the caption.
Re:Progressive JPEGs: a new best practice
by TazeTSchnitzel on Saturday December 29, 2012 @07:52PM
(#4984059)
Or in the HTML.
Re:Progressive JPEGs: a new best practice
by johncoltrane on Sunday December 30, 2012 @03:13AM
(#4985067)
Preferably in the HTML.
Unless width="" and height="" have been deprecated on <img> overnight.
Re:Progressive JPEGs: a new best practice
by TazeTSchnitzel on Sunday December 30, 2012 @05:23AM
(#4985330)
Different use cases IMO. If it's a single image of variable size, use width and height. If there are a bunch of images, all the same size (thumbnails for instance), use CSS.
If you specify width and height explicitly, certain browsers will have issues resizing them (if you set max-width: 100%, Chrome will squish a larger image horizontally but leave the height as it was, IE will scale it proportionally).
Re:Progressive JPEGs: a new best practice
by TazeTSchnitzel on Sunday December 30, 2012 @05:21AM
(#4985324)
I think that's because Chrome treats width= and height= as if they were CSS. (have a look at the inspector on an element with width and height specified in the HTML)
That makes sense (thank you, don't know why I didn't realize that myself), but if I override that with css height: auto; , the browser no longer reserves space for the image while loading it... quite unfortunate.
Re:Progressive JPEGs: a new best practice
by TazeTSchnitzel on Sunday December 30, 2012 @06:32AM
(#4985425)
Maybe you should submit a WebKit (or possibly Chromium if this is Chrome-specific) bug for this.
Re:Progressive JPEGs: a new best practice
by aerobson on Sunday December 30, 2012 @10:35AM
(#4985943)
Why do you say Preferably in the HTML? Just curious. I vaguely recall there was a reason.
Re:Progressive JPEGs: a new best practice
by johncoltrane on Sunday December 30, 2012 @02:24PM
(#4986792)
Because it has been the standard way for a long time.
And because it allows browsers to make room for the image and avoid reflowing.