$ show junevm/splathash
SplatHash is a polyglot image perceptual hashing library that compresses any image into exactly 16 bytes and reconstructs a 32x32 preview. The algorithm decomposes images into a background color and six Gaussian blobs (Splats) using Oklab color space, finds optimal Splat positions via sequential matching pursuit, refines weights with ridge regression, and packs everything into 128 bits. Implementations exist in Go (reference), TypeScript, and Python, all producing bit-identical output for cross-language parity. The system is designed for use as image placeholders during loading, prioritizing decode speed over encode speed.
The LLM identified 1 files worth highlighting for reuse:
Contains the BitWriter/BitReader structs and packV4/unpackV4 functions that implement precise bit-level packing/unpacking of the 16-byte SplatHash format. This component correctly handles bit fields crossing byte boundaries, which is essential for maintaining cross-language parity between implementations. The bit packing logic is isolated, self-contained, and could be extracted for use in other projects requiring reliable bit-level data serialization.