by Jessica Parsons, with help from Monty and Petunia
Photo credits:
All images are my own unless otherwise specified.
JPG - 77 KB
PNG - 77 KB
PNG - 240 KB
Firefox ✗ Chrome ✗ Opera ✗
A cooler JPEG...
(This image is just a regular jpeg)
Someday maybe:
PNG - 3.7 KB
JPG - 3.7 KB
JPG - 13 KB
Image credit:
Screenshot from Silent Hill 2, published by Konami.
Displayed under fair use.
GIF - 4800 KB
JPG - 48 KB
Handy tool: ezgif.com
Someday maybe:
Firefox ✓ Safari ✓
Chrome ✗ (coming in v59) Edge ✗ Opera ✗
More than you expected...
(This image is not an APNG)
MP4 - 455 KB
<video width="320" height="240" autoplay loop muted>
<source src="dogeluge.mp4" type="video/mp4">
<source src="dogeluge.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
JPG - 26 KB
GIF - 111 KB
PNG - 72 KB
But that's not the whole story...
SVG - 0.3 KB
PNG - 4.3 KB
SVG - 0.3 KB
PNG - 2.5 KB
PNG - 2.5 KB
Handy tool: vectormagic.com
Handy tool: clippingmagic.com
Taylor Ho: Using SVGs for Transparent Raster Images
Firefox ✗ Safari ✗ Chrome ✓ Edge ✗ Opera ✓
Like an image format clown car!
(This image is not a WebP)
Someday maybe:
Firefox ✗ Safari ✗ Chrome ✗ Edge ✗ Opera ✗
This smile's worth paying for, right?
(This image is not a BPG)
(now pay up)
Someday maybe:
Firefox ✗ Safari ✗ Chrome ✗ Edge ✗ Opera ✗
Seventeen months old, and already awesome
(This image is not a FLIF)
Someday maybe:
handy tool: responsivebreakpoints.com
with srcset and sizes attributes
<img
sizes="(max-width: 700px) 100vw, 700px"
srcset="
monty_100.jpg 100w,
monty_350.jpg 350w,
monty_509.jpg 509w,
monty_638.jpg 638w,
monty_700.jpg 700w"
src="monty_700.jpg"
alt="Monty curled up in bed">
handy tool: Responsive Image Linter
Use traditional media queries
.shiba-slide {
background-image: url("pet-woods_400.jpg");
background-size: cover;
}
@media (min-width: 401px) {
.shiba-slide {
background-image: url("pet-woods_800.jpg");
}
}
Note: This doesn't always work as you might expect
(see Jake Archibald's talk)
possible future option: `image-set` property
Use the <picture> element and type attribute
<picture>
<source srcset="fancy-doge.webp" type="image/webp">
<img src="fancy-doge.jpg" alt="Petunia looking very fancy">
</picture>
Can even combine with sizes and srcset!
<picture>
<source
sizes="(min-width: 640px) 60vw, 100vw"
srcset="fancy-doge_200.webp 200w,
fancy-doge_400.webp 400w,
fancy-doge_800.webp 800w,
fancy-doge_1200.webp 1200w"
type="image/webp">
<img
src="fancy-doge_400.jpg" alt="Petunia looking fancy"
sizes="(min-width: 640px) 60vw, 100vw"
srcset="fancy-doge_200.jpg 200w,
fancy-doge_400.jpg 400w,
fancy-doge_800.jpg 800w,
fancy-doge_1200.jpg 1200w">
</picture>
JS library: lazySizes
How can we change server settings on the JAMstack?
By choosing your services wisely!
Most hosting services now provide this automatically.
Check your site at checkgzipcompression.com
(Not recommended with real puppers)
Gzip compresses similar bits...
... into one!
so overwhelm
Responsive image plugins for Jekyll
slides.com/verythorough/speedy-images