Faster Images using HTTP2 and Progressive JPEGs
calendar.perfplanet.com
calendar.perfplanet.com
http://www.webperformancetoday.com/2014/09/17/progressive-im...
If the value coming through your site is great enough that marginal improvements (on the order of 1%) are worth time investment (compared to other available improvement avenues) then this is something you should A/B test.
Then again, maybe this is a laziness issue since it seems to me defining a layout independent of actual image content is something that you could do in the 90's.
Went with a padding-top + absolute position in wrapper hack at the end. That jumpiness is part the tooling problem.
I haven't looked in details into the new srcset and size attributes of image, but won't that help also?
Check out http://scottjehl.github.io/picturefill/
You still have to know the aspect ratio of the original image of course, but it does help.
On a second thought, cw, ch as in container width, height would be a great addition.
Isn't that achieved by just defining height and width in percentages?
Small, medium, large?
And what kind of display would you like those for?
1x, 2x or maybe 3x?
Also:
* Popups asking me to download app
* Auto starting video of any sort
* Not loading the complete page so it has to keep loading as you read. This is very inconvenient when sitting on the train or subway with lots of tunnels.
* Link/button for "Read full story" on the story it self.
Most of these are reason enough for me to never visit the page again.
Multiplexing will load the necessary headers just as soon with non-progressive images.
Whoa - I had no idea this is possible. Isn't this a crazy layering violation (why should HTTP2 know about progressive JPEGs)? The links don't seem to provide any more information about it.
edit It looks like HTTP2 only talks about streams. So it's too strong to say that you can flag "individual scan layers with high priority." You can't change the order of scan layers within a JPEG file, or send the file in anything except its natural byte order. So it seems like this has the same limitations as HTTP 1.x.
And would pushing chunks actually require a protocol modification? AIUI http2 push mirrors the hypothetical request headers. So it could essentially push a range-request which the browser could use to partially populate its cache.
The standard metrics these tools provide (JPEG quality or PSNR) are not enough to preserve the visual quality for the variety of images. I'm working on the project to actually do it [1].
My favorite example is the actual Google logo [2]. It's 13 504 bytes and can be reduced almost 2 times to 7 296 bytes saving probably gigabytes of bandwidth each day.
[1] http://getoptimage.com [2] https://www.google.ru/images/branding/googlelogo/2x/googlelo...
Another potentially massive step is to use the srcset [1] attribute of the <img> tag. It lets you provide a bunch of different resolutions for the same image, and the browser will choose the best one to download and render based on the physical screen pixel density, zoom level, and possibly in the future even things like bandwidth preferences or battery level.
Combine the imagemin plugin with a webpack-loader [2] that will auto-generate 5-ish different downscaled versions of an image as srcset, and you get a pretty perfect setup.
My web apps now always use the highest resolution image I have available by default (within reason, I do cut it down to a realistic value), then provide 5 different downscaled versions alongside it in the srcsets automatically which are all run through a battery of optimization to compress them as good as possible. And the browsers will only download the biggest one it can realistically use. Everyone gets high quality images, nobody wastes bandwidth because of support for higher res screens.
[0] https://github.com/Klathmon/imagemin-webpack-plugin
[1] https://css-tricks.com/responsive-images-youre-just-changing...
MozJPEG is actually using something similar called trellis quantization or soft-thresholding. The idea is to further quantize DCT coefficients in noisy areas. There are some limitations [1] though. But it's not an issue with locally sensitive metrics and can be improved with edge detection.
Another challenge here is to estimate the current image quality and the target error.
See: http://calendar.perfplanet.com/2012/progressive-jpegs-a-new-...
I think I've seen this before but I've used an overlay loading gif which was shown over the image while the image loaded then when it loaded the loading gif would be hidden.
It bothers me because I know it's something to address.
So regarding non-javascript, most interfaces are built with JavaScript so what percentage are you addressing?
I've only had the non-javascript come up personally regarding using Tor. I don't know/use Tor much.
I don't ever put <noscript> alerts in ahhh I should though.
I use AdBlock too, not sure if that affects what the desired end-result of non-javascript
Oh yeah, that's the worst. I use uBlock Origin to block third party JS by default, then selectively enable domains I trust (mostly CDN services). This is usually a happy medium between raw and noscript, but it definitely breaks a lot of pages.
I use noscript and disabled JS on iOS Safari, for battery life and security. Not a fanatic noscript user at all, it just seems slightly less bad than full js at this point.
Graceful degradation is a better choice than <noscript> tags, where possible. Which, for <img>, it is.
thanks for considering the minority, even if it doesn't pan out :)
Hmm yeah I guess I'm not as up to date with mobile(the stuff you mentioned)
<noscript class="js-progressiveMedia-inner">
<img class="progressiveMedia-noscript js-progressiveMedia-inner" src="https://cdn-images-1.medium.com/max/800/1*vY3BMZ9BrxgkD7je7f-Ckw.jpeg"
</noscript>The placeholder images are JS-generated solid color PNGs downscaled to just keep the same aspect ratio. SVGs could be much easier but less supported probably.
I like progressive images, and the whole idea, but some catchy video about a page re-layouting multiple times as images arrive on traditional http+simple jpeg would be the most convincing.
The polyfill is pretty light because the underlying image format is just a single frame of VP8. Shouldn't get much performance hit since it will just render as a single frame of video on polyfilled browsers
Not sure why we're downvoted here, either of these are clearly better options for increasing image download speed