Imgsim
Golang library for computing perceptual hashes of images
Install / Use
/learn @Nr90/ImgsimREADME
Imgsim

Imgsim is a library allows you to compute a fast perceptual hashes of an image. These hashes can then be used to compare images for similarity. Similar looking images will get similar perceptual hashes. Unlike cryptographic hashes that would be very different for images with slight differences. This makes them suitable to compare how similar images are.
Average hash
An average hash is an example of a perceptual hash.
For an introduction see: Average hash
Difference hash
Difference hashes are said to be more resillient to changes in the image then the Average hash.
For an introduction see: Difference hash
Installation
The package is go-gettable: go get -u github.com/Nr90/imgsim.
Example
package main
import (
"fmt"
"image/png"
"os"
"github.com/Nr90/imgsim"
)
func main() {
imgfile, err := os.Open("assets/gopher.png")
defer imgfile.Close()
if err != nil {
panic(err)
}
img, err := png.Decode(imgfile)
if err != nil {
panic(err)
}
ahash := imgsim.AverageHash(img)
fmt.Println(ahash)
dhash := imgsim.DifferenceHash(img)
fmt.Println(dhash)
}
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
339.3kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
