In: computer, image.

Backlinks: image.

Visual Hash

A visual hash is an image, generated from a text, just as an ordinary cryptographic hash is usually represented as a hexadecimal string.
The advantage of a visual hash is that it is easier for humans to remember and compare.


Github identicons
> Our Identicons are simple 5×5 “pixel” sprites that are generated using a hash of the user’s ID
> The algorithm walks through the hash and turns pixels on or off depending on even or odd values
> These generated patterns, combined with hash-determined color values, ensures a huge number of unique Identicons

Represent SHA-256 hashes as avatars

A very compact representation of a placeholder for an image

BlurHash takes an image, and gives you a short string (only 20-30 characters!) that represents the placeholder for this image

Dithering algorithms for arbitrary palettes in Python PIL

Error diffusion dithering algos, Standard ordered dithering, Yliluoma’s ordered dithering

Perceptual hash

A perceptual hash is a fingerprint of a multimedia file derived from various features from its content.
Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output,
perceptual hashes are “close” to one another if the features are similar.

The image hash algorithms (average, perceptual, difference, wavelet) analyse the image structure on luminance (without color information).
The color hash algorithm analyses the color distribution and black & gray fractions (without position information).


The problem with Perceptual Hashes

Apple just announced that they will use perceptual hashing to spy on us, the official story is “detect illegal photos on iPhones”
None of these algorithms are waterproof, these algorithms will fail sometimes.
Perceptual hashes are messy. The simple fact that image data is reduced to a small number of bits leads to collisions and therefore false positives. When such algorithms are used to detect criminal activities, especially at Apple scale, many innocent people can potentially face serious problems.

Analysis of perceptual hashing algorithms in image manipulation detection

How to create a duplicate image detection system

Learn how to use perceptual hash functions and nearest neighbor searches to detect duplicate images


Like aHash and pHash, dHash is pretty simple to implement and is far more accurate than it has any right to be.
As an implementation, dHash is nearly identical to aHash but it performs much better.
While aHash focuses on average values and pHash evaluates frequency patterns, dHash tracks gradients.


One of the simplest hashes represents a basic average based on the low frequencies.
With pictures, high frequencies give you detail, while low frequencies show you structure.
A large, detailed picture has lots of high frequencies. A very small picture lacks details, so it is all low frequencies.