# BlurHash and ThumbHash image placeholders

> BlurHash and ThumbHash give your images stunning yet lightweight loading placeholders, taking the image viewing experience to the next level.

Traditional image loading often leaves users waiting or staring at a blank page. BlurHash and ThumbHash use lightweight hash values to generate blurred placeholder images ahead of time, giving users instant feedback and dramatically improving the loading experience.

Bitiful **CoreIX natively supports** both [BlurHash](https://blurha.sh/) and [ThumbHash](https://evanw.github.io/thumbhash/) image placeholder hashes. Just use the [fmt=blurhash](/en/coreix/features/fmt) or [fmt=thumbhash](/en/coreix/features/fmt) parameter to get them.

## Comparing image placeholder approaches

| **Feature**        | **Gaussian-blurred image**                                      | **BlurHash**                                           | **ThumbHash**                                                      | **Dominant color**                                             |
| :----------------- | :-------------------------------------------------------------- | :----------------------------------------------------- | :----------------------------------------------------------------- | :------------------------------------------------------------- |
| Database storage   | Large (200 \~ 5k bytes)                                         | Tiny (30+ bytes)                                       | Tiny (20+ bytes)                                                   | Smallest (7-9 characters)                                      |
| Blur quality       | Best                                                            | Good                                                   | Very good                                                          | No detail at all                                               |
| Performance impact | Significant database impact                                     | Minimal                                                | Minimal                                                            | Minimal                                                        |
| Overall            | Best blur qualityVery large storage footprintAverage efficiency | Good blur qualitySmall storage footprintVery efficient | Very good blur qualityEven smaller storage footprintVery efficient | Solid color, no detailSmallest storage footprintMost efficient |

> **Tip**
>
> We're grateful to [BlurHash](https://evanw.github.io/thumbhash/) and [ThumbHash](https://blurha.sh/) for being open source, but the original libraries support **very few** image formats and can't easily handle **video** or **animated images**. Thanks to Bitiful CoreIX's excellent compatibility with **video**, **image formats**, and **color modes**, you can simply call our API and get a wide range of **extra compatibility** in 0.1 seconds, including:
>
> 1. Photos in color gamuts or color modes such as P3, Adobe RGB, and CMYK
> 2. A wide range of RAW formats
> 3. Hash placeholders for `video` and `animated images`, using the [frame capture parameter](/en/coreix/features/frame)

## Preview

![blurhash-sample](https://files.bitiful.com/images/hash-placeholder.png?w=1200&fmt=webp)

BlurHash example: the original image on the left and the blurred placeholder generated from its BlurHash on the right

## How to use it

### How it works

1. Append the corresponding parameter to the image URL:
   - BlurHash: `fmt=blurhash`
   - ThumbHash: `fmt=thumbhash`
2. Store the returned `placeholder hash` directly in your database.
3. When the client requests data, include the `placeholder hash` directly in the API response (for example, JSON).
4. The client decodes the blurred image from the `placeholder hash` in the corresponding response field and fills the image container with it (for example, an img tag in HTML). This step requires no network access and takes well under a millisecond, so users see the blurred placeholder with no perceptible delay.
5. Then load the sharp thumbnail or original image remotely from its URL.

> **Warning**
>
> Combine with the crop and resize parameters to get a blur hash for a specific part of the original image.
