Skip to content

ajdnik/imghash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

imghash logo

Go implementation of multiple perceptual hash algorithms for images.

CI status Coverage status Go reference Go report card MIT license

Documentation

Full documentation lives on the wiki. It covers installation, a quick start guide, a per-algorithm reference (options, defaults, references, examples) for every hasher shipped with the library, an API reference for the Hasher / Comparer interfaces and the similarity distance functions, conceptual guides on hash types and interpolation methods, and practical guides for choosing an algorithm, comparing hashes, real-world examples, and migrating from v1 to v2.

Installing

go get -u github.com/ajdnik/imghash/v2
import "github.com/ajdnik/imghash/v2"

Most consumers only need the top-level imghash package. Core types (Hash, Binary, UInt8, Float64, Distance) are re-exported there.

Quick Start

If you're unsure which hash to pick, start with PDQ.

package main

import (
  "fmt"

  "github.com/ajdnik/imghash/v2"
)

func main() {
  pdq, err := imghash.NewPDQ()
  if err != nil {
    panic(err)
  }

  h1, err := imghash.HashFile(pdq, "image1.png")
  if err != nil {
    panic(err)
  }

  h2, err := imghash.HashFile(pdq, "image2.png")
  if err != nil {
    panic(err)
  }

  dist, err := pdq.Compare(h1, h2)
  if err != nil {
    panic(err)
  }

  fmt.Printf("Distance: %v\n", dist)
}

License

Imghash is released under the MIT license. See LICENSE.

About

Perceptual image hashing package for golang.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors