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.0(5mo ago)160107.2k↑15.8%89MITPHPPHP ^7.3 || ^8.0CI passing

Since Mar 23Pushed 5mo 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 1mo ago

READMEChangelog (7)Dependencies (1)Versions (11)Used By (9)

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

53

—

FairBetter than 97% of packages

Maintenance70

Regular maintenance activity

Popularity49

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.5% 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 ~163 days

Recently: every ~232 days

Total

7

Last Release

172d 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 (22 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (1 commits)")[![iamriajul](https://avatars.githubusercontent.com/u/24244379?v=4)](https://github.com/iamriajul "iamriajul (1 commits)")[![jimwins](https://avatars.githubusercontent.com/u/329264?v=4)](https://github.com/jimwins "jimwins (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)")

---

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

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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