https://github.com/galdor/go-thumbhash
A Go implementation of the Thumbhash image placeholder generation algorithm.
https://github.com/galdor/go-thumbhash
go golang image-placeholders thumbhash
Last synced: 4 months ago
JSON representation
A Go implementation of the Thumbhash image placeholder generation algorithm.
- Host: GitHub
- URL: https://github.com/galdor/go-thumbhash
- Owner: galdor
- License: isc
- Created: 2023-03-23T11:28:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T14:06:56.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T11:21:59.999Z (over 1 year ago)
- Topics: go, golang, image-placeholders, thumbhash
- Language: Go
- Homepage:
- Size: 548 KB
- Stars: 82
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-thumbhash
## Introduction
The go-thumbhash library implements the
[Thumbhash](https://evanw.github.io/thumbhash/) image placeholder generation
algorithm invented by [Evan Wallace](https://madebyevan.com/).
This algorithm is used to calculate a small binary hash representing an image
using a [Discrete Cosine
Transform](https://en.wikipedia.org/wiki/Discrete_cosine_transform). The hash
can then be used to generate a lossy representation of the original image.
The main use case is progressive loading of a web page containing lots of
images, e.g. a photo gallery. Store the hash of each image in your database,
and send it in the HTML document. On the client side, use Javascript (e.g.
Evan Wallace's library) to generate a placeholder image from the hash. Then
load the original image asynchronously.

## Usage
Refer to the [Go package
documentation](https://pkg.go.dev/go.n16f.net/thumbhash) for information about
the API.
See the [`thumbhash` program](cmd/thumbhash/main.go) for a practical use case.
# Licensing
Go-thumbhash is open source software distributed under the
[ISC](https://opensource.org/licenses/ISC) license.