dhash

package module
v0.0.0-...-420362d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2015 License: MIT Imports: 4 Imported by: 0

README

dhash

dHash algorithm in Go

GoDoc Travis CI status

Install

go get github.com/guilhermehn/dhash

Or with gopkg:

go get gopkg.in/guilhermehn/dhash.v1

Usage

Two parameters are needed: the path to the image and the size that the image will be resized to, that will reflect into the hash size. The recommended size is 8.

Dhash("image.jpg", 8)

The image will be resized to 8x8 and the hash size will be size*2: "8899aabbccddeeff".

Example:
package main

import (
  "fmt"
  "github.com/guilhermehn/dhash"
  // or if you installed the gopkg version
  // "gopkg.in/guilhermehn/dhash.v1"
)

func main() {
  pathToImage := "path/to/image"
  detailLevel := 8

  hash, err := dhash.Dhash(pathToImage, detailLevel)

  if err != nil {
    fmt.Println("ERROR: %s", err.Error())
    return
  }

  fmt.Println(hash)
}

Dependencies

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dhash

func Dhash(path string, size int) (string, error)

Runs a difference hash algorithm on the image and returns a hash string and a error if there was one during the function execution.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL