Generates a ThumbHash for every image file and stores it with the file. A ThumbHash is a placeholder of about 30 characters that clients decode into a blurred preview while the image loads.
Features
- Adds a
thumbhashfield to file entities. - Generates the hash when an image file is saved for the first time or replaced.
- Downscales with an image style first, so it works with GD and ImageMagick. SVG is skipped.
- Can generate the hashes during cron instead of on save.
- Drush command for existing files.
Post-Installation
No configuration is needed. Run drush thumbhash:generate once for existing images (options: --limit, --force, --queue).
Settings are at /admin/config/media/thumbhash: the image style used for downscaling, and whether to generate the hashes during cron.
The module does not display the hashes. Read them with:
- PHP:
$file->get('thumbhash')->value - JSON:API: the
thumbhashattribute of file resources - Core REST:
thumbhash[0].value, once theentity:fileresource is enabled
The hash describes the original image, so it won't match image styles that crop.
Additional Requirements
- Drupal 11.2 or later
- srwiez/thumbhash, which Composer installs for you
Similar projects
- Blurhash: calculates a BlurHash on every render and doesn't store it.
- Image Blurry Placeholder: adds a tiny background image in the core image formatters. It provides no hash for APIs.
Ask your assistant about ThumbHash
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-alpha1 | Pre-release | 11 | Oct 26, 2026 |