Skip to content

libphash API reference

Every public function, type and constant of libphash.h, grouped by topic. The usual path through the library:

  1. Create a context — Context.
  2. Load an image into it, from a file, a buffer or raw pixels — Loading images.
  3. Compute hashes: 64-bit hashes (aHash, dHash, pHash, wHash) or Digest hashes (mHash, BMH, Radial, ColorHash, ColorMoments); any of them by value through Algorithms as values.
  4. Compare two hashes with the function their kind calls for — Comparing hashes.
  5. Store them as text — Hashes as text.

Many images at once go through Batch hashing; tuning is in Algorithm parameters; every failure is explained in Errors; the version and the decoders a build carries are in Version and build.

The guides — which algorithm to choose, how batches and threads behave, how the library is built and verified — are the Markdown pages in the repository's docs/ directory.

Topics

  • Errors — Every failure is a ph_error_t; how to read one, and the details of the last failed load.
  • Context — The ph_context_t that holds one image and its configuration: create, free, and what is loaded.
  • Loading images — From a file, a memory buffer or raw pixels, and the settings that shape the pixels at load time: grayscale, transparency, orientation, size limit, decode scale.
  • Algorithm parameters — Grayscale weights, gamma, and each algorithm's own tuning.
  • 64-bit hashes — aHash, dHash, pHash and wHash, alone or several at once with ph_compute_multi().
  • Digest hashes — mHash, BMH, Radial, ColorHash and ColorMoments, returned as a ph_digest_t.
  • Algorithms as values — Any algorithm through one call, selected by a ph_algorithm_t or its name.
  • Comparing hashes — Distances and similarities, one per kind of digest.
  • Hashes as text — Storing and reading back hashes and digests as hex strings.
  • Batch hashing — Many files or buffers in one call, on a pool of worker threads.
  • Version and build — The library's version, the decoders it was built with, and the ABI conventions.

Index A–Z

Every function, type, constant and enumerator, by its name without the ph_ or PH_ prefix.

A · B · C · D · E · F · G · H · I · L · R · S · V · W

A

B

C

D

E

F

G

H

I

L

R

S

V

W