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
First, I’d like to extend my gratitude to @evanw for creating this outstanding library.
I’ve noticed that quite a few developers encounter challenges with the core concept of libraries like ThumbHash and BlurHash, as discussed in issue #37, among others. Many of us, myself included, initially approached this by sending a pre-decoded image as a data URI to the browser instead of just the hash. This alternative simply is far less complex in certain use cases, such as single-page applications or infinite scrolls, where relying on the DOMContentLoaded event to decode the hash and render a canvas/image is not enough.
By default, the <thumb-hash> element renders a canvas. Additional rendering strategies include average to display the average color or img to generate an image with a data URI.
I hope this proves helpful to anyone looking for a streamlined solution! 🙂
The text was updated successfully, but these errors were encountered:
Hello!
First, I’d like to extend my gratitude to @evanw for creating this outstanding library.
I’ve noticed that quite a few developers encounter challenges with the core concept of libraries like ThumbHash and BlurHash, as discussed in issue #37, among others. Many of us, myself included, initially approached this by sending a pre-decoded image as a data URI to the browser instead of just the hash. This alternative simply is far less complex in certain use cases, such as single-page applications or infinite scrolls, where relying on the
DOMContentLoaded
event to decode the hash and render a canvas/image is not enough.To address this, I recently published a small package that offers a self-initializing custom element,
<thumb-hash>
, specifically for rendering ThumbHashes. You can find it here: https://github.com/hirasso/thumbhash-custom-elementThe following HTML:
…will be transformed as shown below at runtime:
By default, the
<thumb-hash>
element renders a canvas. Additional rendering strategies includeaverage
to display the average color orimg
to generate an image with a data URI.I hope this proves helpful to anyone looking for a streamlined solution! 🙂
The text was updated successfully, but these errors were encountered: