-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
101 lines (81 loc) · 3.24 KB
/
index.html
File metadata and controls
101 lines (81 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Sample implementation of blur-up progressive image loading.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Blur-up image loading</title>
<style type="text/css">
* {
font-family: Helvetica, Arial, sans-serif;
line-height: 1.2em;
color: black;
}
a {
text-decoration: none;
display: inline-block;
padding: 0 0.1em;
border-bottom: 1px dotted #aaa;
transition: all 0.1s ease-in-out;
}
p {
max-width: 40em;
margin-bottom: 1.4em;
}
a:hover,
a:hover pre {
color: #eee;
background-color: #222;
border-bottom-color: #eee;
}
ul {
list-style-type: circle;
}
li {
margin-bottom: 1em;
}
pre, code{
display: inline-block;
font-family: Courier, serif;
color: #777;
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0,0,0,0.04);
border-radius: 3px;
}
</style>
</head>
<body>
<h1>Blur-up Image Loading Exploration</h1>
<p>Implementation exploration of blur-up progressive image loading. Inspired by
<a href="https://css-tricks.com/the-blur-up-technique-for-loading-background-images/" target="blank">this</a>
post at CSS-Tricks (which is an exploration of a
<a href="https://code.facebook.com/posts/991252547593574/the-technology-behind-preview-photos/" target="blank">Facebook engineering team article</a>).
</p>
<p>I explored taking an original high-quality image asset and converting it to a small thumbnail/placeholder image
that would be displayed before the main content asset loads. This image will be a background image on the content
image's parent wrapper (the placeholder is arguably decoration, not content, and should therefore be in the CSS).
The content image will be using the <code>srcset</code> and <code>sizes</code> attributes (fallbacks are out of
the scope of this exploration).
</p>
<p>The placeholder image was created after testing various methods. The result is an image that is scaled down to
100px width at 72dpi, given a gaussian blur of 5px, then saved as a JPG at 50% quality, and finally run through
<a href="https://imageoptim.com/" target="blank">ImageOptim</a>.
</p>
<p>There are two versions of this example: one with the placeholder as an external image file, and another with the
file base64-encoded and written into the wrapper as a background image. In both cases the remaining background-related
styles are inline, as well, to avoid waiting for external CSS to be loaded and parsed.
</p>
<p>To really see the effect, I suggest disable your browser cache and throttling your network performance to something
ludicrously low, e.g. GPRS or 2G.
</p>
<ul>
<li><a href="blur-up.html">Blur-up with external small placeholder image file</a></li>
<li><a href="blur-up-base64bg.html">Blur-up with base-64 encoded placeholder image</a></li>
</ul>
</body>
</html>