ThumbHash

Each Source record has a thumb_hash field, which holds a short string that can be used to render a blurred placeholder while the real image loads. By default it is a ThumbHash, base64 encoded.

Install the thumbhash extra (see Installation) to enable the default hasher. Without it, thumb_hash stays empty.

The hash is generated when the first thumbnail of a source image is created and is available through Thumbnailer.get_thumb_hash(). For sources that already have thumbnails, generate the missing hashes with thumbnail thumb_hash.

Custom hashers

Set THUMBNAIL_HASHER to the dotted path of a function that takes the PIL source image and returns a string (at most 64 characters) or None:

THUMBNAIL_HASHER = 'myapp.hashers.blurhash'

Set it to None to disable hashing.

easy_thumbnails.hashers.default(image)

Generate a ThumbHash of a PIL image.

Returns the hash base64 encoded, or None if the thumbhash extra (fast-thumbhash-rs) is not installed or the image is not a PIL image (e.g. an SVG).