A Responsive Image Container
Yoav Weiss
Responsive Images Meet-up - Paris, September 2013
AKA: The "magical" image format
Solutions!
Markup solutions
HTTP solutions
But, But
we wanted an image format!!!
How?
A container with multiple layers and an offset table on top
Layer: A residual image between the previous decoded image resolution, and the current one*
* with a twist
*The twist
The previous decoded image resolution can be repositioned and upscaled
Layer payload can be in various formats
- e.g. WebP, JPEG-XR
- Not JPEG, since residual images are too big
Fetching?
- HTTP ranges
- Fetch an initial range
- Browser fetches the rest of the image gradually
- Can be optimized with a manifest
Advantages
- Markup left untouched
- A single file per image
- Better for post-download dimensions changes
disadvantages
- Touches many layers. Will take time
- Decoding performance???
- Network performance???
Now to something completely different
Let's talk about srcset's future
Current implementation
<img src="cat.1X.jpg"
srcset="cat.1x.jpg 1x, cat.2x.jpg 2x">
Suggested resolution switching qualifiers
<img src="cat.1X.jpg"
srcset="cat.1x.jpg 1x 320w, cat.2x.jpg 2x 320w, cat.2x.jpg 1x 640w, cat.4x.jpg 2x 640w, cat 4x.jpg 1x 1280w">
Web dev's response to this
My proposal
Define a new qualifier as a multiple of a "base viewport" and DPR
<img src="cat.1X.jpg"
srcset="cat.1x.jpg 1m, cat.2x.jpg 2m, cat.4x.jpg 4m">
Or...
<img src="cat.1X.jpg"
srcset="cat.1x.jpg 1x 320w, cat.2x.jpg (2x 320w, 1x 640w), cat.4x.jpg (2x 640w, 1x 1280w)">
Same can be mirrored with CH