You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Converts a [BlurHash](https://blurha.sh) to a [CSS Object](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style) using [TypeScript](https://www.typescriptlang.org/), [Rust](https://www.rust-lang.org/), and [WebAssembly](https://github.com/rustwasm/wasm-pack).
[](https://github.com/JamieMason)
11
-
[](https://twitter.com/fold_left)
5
+
[](https://www.npmjs.com/package/blurhash-to-css)[](https://www.npmjs.com/package/blurhash-to-css)[](https://github.com/JamieMason)[](https://twitter.com/fold_left)
12
6
13
7
## 🌩 Installation
14
8
@@ -18,25 +12,16 @@ npm install blurhash-to-css
18
12
19
13
## 📣 Summary
20
14
21
-
[BlurHash](https://blurha.sh) is a compact representation of a placeholder for an image, which makes
22
-
it a great option to [improve perceived load times](https://blog.imgix.com/2021/01/26/blurhash).
23
-
But, a BlurHash is rendered using a `<canvas>` element, which means client-side JavaScript is needed
24
-
on the critical path when loading our application.
15
+
[BlurHash](https://blurha.sh) is a compact representation of a placeholder for an image, which makes it a great option to [improve perceived load times](https://blog.imgix.com/2021/01/26/blurhash). But, a BlurHash is rendered using a `<canvas>` element, which means client-side JavaScript is needed on the critical path when loading our application.
25
16
26
-
This tool creates the same visual effect using CSS, which can be rendered on the Server without any
27
-
dependency on client-side JavaScript.
17
+
This tool creates the same visual effect using CSS, which can be rendered on the Server without any dependency on client-side JavaScript.
28
18
29
-
An example can be seen at https://blurhash-to-css.vercel.app and the source is in this repo at
An example can be seen at https://blurhash-to-css.vercel.app and the source is in this repo at [`/example`](https://github.com/JamieMason/blurhash-to-css/tree/main/example).
31
20
32
21
## 🤝 Credit
33
22
34
-
- The image buffer to CSS conversion is a port to Rust of
- The image buffer to CSS conversion is a port to Rust of [this Script](https://github.com/joe-bell/plaiceholder/blob/d09df807df5d11c5d91a7971c2f90e2faa845843/packages/css/src/index.ts#L18-L51) originally by [**@joe-bell**](https://github.com/joe-bell) for [plaiceholder: Beautiful image placeholders, without the hassle](https://plaiceholder.co/).
24
+
- A lot of help came from the source code in [wasm-image](https://github.com/peerigon/wasm-image) by [**@acidicX**](https://github.com/acidicX).
A small string generated to represent a blurry version of an image which will download sometime
73
-
soon. Have a play around on [BlurHash](https://blurha.sh),
74
-
[plaiceholder.co](https://plaiceholder.co/), and have a read of
75
-
[BlurHash for imgix: An Alternative to Generic Image Placeholders](https://blog.imgix.com/2021/01/26/blurhash)
76
-
to try them out and find out more.
57
+
A small string (or array of strings) generated to represent a blurry version of an image which will download sometime soon. Have a play around on [BlurHash](https://blurha.sh), [plaiceholder.co](https://plaiceholder.co/), and have a read of [BlurHash for imgix: An Alternative to Generic Image Placeholders](https://blog.imgix.com/2021/01/26/blurhash) to try them out and find out more.
77
58
78
59
### `width` and `height` (optional)
79
60
80
-
The BlurHash is decoded into a 10 x 10 image by default, you can make this larger and it will look
81
-
more like the final image, but it will also generate a lot more CSS.
61
+
The BlurHash is decoded into a 10 x 10 image by default, you can make this larger and it will look more like the final image, but it will also generate a lot more CSS.
0 commit comments