PHPackages                             srwiez/thumbhash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. srwiez/thumbhash

ActiveLibrary[Image &amp; Media](/categories/media)

srwiez/thumbhash
================

A brief description of your package

v1.5.1(1mo ago)163128.4k—5.4%810MITPHPPHP ^7.3 || ^8.0CI passing

Since Mar 23Pushed 2d ago3 watchersCompare

[ Source](https://github.com/SRWieZ/thumbhash)[ Packagist](https://packagist.org/packages/srwiez/thumbhash)[ GitHub Sponsors](https://github.com/SRWieZ)[ RSS](/packages/srwiez-thumbhash/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (2)Versions (14)Used By (10)

Thumbhash PHP
=============

[](#thumbhash-php)

[![Tests](https://github.com/SRWieZ/thumbhash/actions/workflows/test.yml/badge.svg)](https://github.com/SRWieZ/thumbhash/actions/workflows/tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/fe41b544643b9390c91429d080682310322837f176046f877abb6a8b481e6973/68747470733a2f2f706f7365722e707567782e6f72672f73727769657a2f7468756d62686173682f762f737461626c65)](https://packagist.org/packages/srwiez/thumbhash)

Thumbhash PHP is a PHP library for generating unique, human-readable identifiers from image files. It is inspired by [Evan Wallace's Thumbhash algorithm](https://github.com/evanw/thumbhash) and provides a PHP implementation of the algorithm.

Thumbhash is a very compact representation of a placeholder for an image. Store it inline with your data and show it while the real image is loading for a smoother loading experience. It's similar to [BlurHash](https://github.com/woltapp/blurhash) but with some advantages

[Read more and test it here !](https://evanw.github.io/thumbhash/)

Installation
------------

[](#installation)

You can install Thumbhash PHP using Composer:

```
composer require srwiez/thumbhash
```

⚠️ I highly recommend to have Imagick extension installed on your computer. GD extension has only 7 bits of alpha channel resolution, and 127 is transparent, 0 opaque. While the library will still work, you may have different image between platforms. [See on stackoverflow](https://stackoverflow.com/questions/41079110/is-it-possible-to-retrieve-the-alpha-value-of-a-pixel-of-a-png-file-in-the-0-255)

Usage
-----

[](#usage)

To generate a thumbhash for an image file, you can use the Thumbhash\\Thumbhash class:

Example to show a thumbhash image from a local file

```
use Thumbhash\Thumbhash;

$content = file_get_contents($url);

list($width, $height, $pixels) = extract_size_and_pixels_with_imagick($content);

$hash = Thumbhash::RGBAToHash($width, $height, $pixels);
$key = Thumbhash::convertHashToString($hash); // You can store this in your database as a string
$url = Thumbhash::toDataURL($hash);

echo '';
```

Note

Like the original library implementation, your image must not exceed 100x100 pixels.

Credits
-------

[](#credits)

Thumbhash PHP was created by Eser DENIZ.

It is inspired by the javascript version of [Evan Wallace's Thumbhash algorithm](https://github.com/evanw/thumbhash).

License
-------

[](#license)

Thumbhash PHP is licensed under the MIT License. See LICENSE for more information.

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance95

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~164 days

Recently: every ~206 days

Total

8

Last Release

45d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

1.1.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/735894a4f6e39aa85e3d136abc9cf0be92da593d88731382384185293cbfe965?d=identicon)[SRWieZ](/maintainers/SRWieZ)

---

Top Contributors

[![SRWieZ](https://avatars.githubusercontent.com/u/1408020?v=4)](https://github.com/SRWieZ "SRWieZ (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (1 commits)")[![marconett](https://avatars.githubusercontent.com/u/3315507?v=4)](https://github.com/marconett "marconett (1 commits)")[![tobimori](https://avatars.githubusercontent.com/u/29142128?v=4)](https://github.com/tobimori "tobimori (1 commits)")[![jimwins](https://avatars.githubusercontent.com/u/329264?v=4)](https://github.com/jimwins "jimwins (1 commits)")[![iamriajul](https://avatars.githubusercontent.com/u/24244379?v=4)](https://github.com/iamriajul "iamriajul (1 commits)")

---

Tags

imagelazy-loadingphpthumbhash

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/srwiez-thumbhash/health.svg)

```
[![Health](https://phpackages.com/badges/srwiez-thumbhash/health.svg)](https://phpackages.com/packages/srwiez-thumbhash)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
