JPEG blur
Before blur: 211KB After blur: 150KB
responsivedesign.is/articles/reducing-image-sizes
Slide 33
Slide 33 text
JPEG crop
Left crop: 50KB Right crop: 60KB
Center crop: 57KB
Slide 34
Slide 34 text
GIF
Graphics Interchange Format
Introduced by CompuServe in 1987.
Enhanced version (animation!) in 1989.
Slide 35
Slide 35 text
GIF Best for: Animations that can’t be
replaced with CSS.
Slide 36
Slide 36 text
GIF
Contain up to 256 colors (per frame).
Are lossless.
Please don’t use them.
Slide 37
Slide 37 text
… if you must use a GIF…
Slide 38
Slide 38 text
GIF Dithering gives the appearance
of a smoother blend.
Slide 39
Slide 39 text
Dithering set to 0:
4.8KB
Dithering set to 100:
9.7KB
Slide 40
Slide 40 text
Horizontal pattern:
9.7KB
Vertical pattern:
21KB
Slide 41
Slide 41 text
GIF
Their compression algorithm removes
horizontal redundancy.
The more details or noise,
the larger the file will be.
Slide 42
Slide 42 text
GIF
So seriously, folks:
Replace GIF animations with CSS.
Replace non-animated GIFs with PNG-8s.
Replace movie GIFs with
asynchronously-loading videos.
Slide 43
Slide 43 text
No content
Slide 44
Slide 44 text
GIF:
21KB
PNG-8:
1.62KB
Slide 45
Slide 45 text
PNG
Portable Network Graphics
Created as an improved, non-patented
replacement for GIF in 1996.
Slide 46
Slide 46 text
PNG-8 Best for: Images with few colors.
Slide 47
Slide 47 text
PNG-8
Lossless (like GIFs!)
256 color palette (like GIFs!)
Dither (like GIFs!)
Recognize horizontal and vertical patterns.
Slide 48
Slide 48 text
PNG-24
No restriction on color palette.
Handles transparency differently.
Slide 49
Slide 49 text
PNG-24
Optimization options:
Decrease noise.
Decrease number of colors.
Slide 50
Slide 50 text
PNG-24:
1.28MB
JPEG @ 75 Quality:
288KB
Slide 51
Slide 51 text
WebP
Google announced WebPicture in 2010.
Both lossless and lossy compression.
Supports transparency and animation.
Slide 52
Slide 52 text
WebP
Predicts a value, then encodes the
difference between the prediction and
actual value.
Slide 53
Slide 53 text
WebP
Creation: there’s a Photoshop plugin,
and online conversion tools.
Support: only Chrome, Opera,
and Android Browser.
Slide 54
Slide 54 text
Save even more
bytes and requests
Slide 55
Slide 55 text
Replace simple images
with SVG.
Slide 56
Slide 56 text
SVG
Scalable Vector Graphics
XML-based vector image format, born out
of competing standards submitted to W3C.
Became a W3C recommendation in 2001.
Slide 57
Slide 57 text
SVG
Scales up beautifully for retina devices.
If inline, eliminates an HTTP request.
Not supported ≤IE8.
Exports with a lot of cruft.
Slide 58
Slide 58 text
Slide 59
Slide 59 text
Slide 60
Slide 60 text
Slide 61
Slide 61 text
You can apply it as a background:
.star {
background: url(star.svg);
display: block;
width: 83px;
height: 83px;
background-size: 83px 83px;
}
Slide 62
Slide 62 text
Or inline the SVG into your HTML:
Slide 63
Slide 63 text
SVG
Inlined SVG removes cacheability and
makes your HTML file size larger.
So, as with everything else, test it.
Slide 64
Slide 64 text
Sprites
Slide 65
Slide 65 text
No content
Slide 66
Slide 66 text
responsive
images
Slide 67
Slide 67 text
Slide 68
Slide 68 text
Slide 69
Slide 69 text
Slide 70
Slide 70 text
Additional lossless
compression
Slide 71
Slide 71 text
No content
Slide 72
Slide 72 text
We ran all PNGs in Etsy’s templates through
lossless compression.
Average per-file space savings 19.76%
Total space savings 44.34%