Go to file
Timmy Welch cb5a8237c4 Update module path 2024-05-01 18:06:48 -07:00
.github Update module path 2024-05-01 18:06:48 -07:00
_examples Update module path 2024-05-01 18:06:48 -07:00
etcs Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
hashImage Update module path 2024-05-01 18:06:48 -07:00
test Add testing system 2024-05-01 17:59:11 -07:00
transforms Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
.gitignore Add testing system 2024-05-01 17:59:11 -07:00
.pre-commit-config.yaml Add testing system 2024-05-01 17:59:11 -07:00
AUTHORS.md Refactored Perceptionhash for performance (#54) 2022-05-26 15:56:47 +09:00
CODEOWNERS [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
Gopkg.lock Update dependencies from go module and dep tool. (#36) 2019-12-07 23:29:03 +09:00
Gopkg.toml Update dependencies from go module and dep tool. (#36) 2019-12-07 23:29:03 +09:00
LICENSE Initial commit 2017-07-29 02:15:59 +09:00
README.md Update module path 2024-05-01 18:06:48 -07:00
doc.go [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
go.mod Update module path 2024-05-01 18:06:48 -07:00
go.sum Add testing system 2024-05-01 17:59:11 -07:00
hashcompute.go Update module path 2024-05-01 18:06:48 -07:00
hashcompute_test.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
imagehash.go Add testing system 2024-05-01 17:59:11 -07:00
imagehash18.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
imagehash19.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
imagehash_test.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
setup.cfg Add testing system 2024-05-01 17:59:11 -07:00
yuv.color.convert.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00
yuv.fancy.upscaling.go Make compliant with python imagehash 2024-04-05 17:29:30 -06:00

README.md

GitHub Action GoDoc Go Report Card

goimagehash

Inspired by imagehash

A image hashing library written in Go. ImageHash supports:

Installation

go get gitea.narnian.us/lordwelch/goimagehash

Special thanks to

Usage

func main() {
        file1, _ := os.Open("sample1.jpg")
        file2, _ := os.Open("sample2.jpg")
        defer file1.Close()
        defer file2.Close()

        img1, _ := jpeg.Decode(file1)
        img2, _ := jpeg.Decode(file2)
        hash1, _ := goimagehash.AverageHash(img1)
        hash2, _ := goimagehash.AverageHash(img2)
        distance, _ := hash1.Distance(hash2)
        fmt.Printf("Distance between images: %v\n", distance)

        hash1, _ = goimagehash.DifferenceHash(img1)
        hash2, _ = goimagehash.DifferenceHash(img2)
        distance, _ = hash1.Distance(hash2)
        fmt.Printf("Distance between images: %v\n", distance)
        width, height := 8, 8
        hash3, _ := goimagehash.ExtAverageHash(img1, width, height)
        hash4, _ := goimagehash.ExtAverageHash(img2, width, height)
        distance, _ = hash3.Distance(hash4)
        fmt.Printf("Distance between images: %v\n", distance)
        fmt.Printf("hash3 bit size: %v\n", hash3.Bits())
        fmt.Printf("hash4 bit size: %v\n", hash4.Bits())

        var b bytes.Buffer
        foo := bufio.NewWriter(&b)
        _ = hash4.Dump(foo)
        foo.Flush()
        bar := bufio.NewReader(&b)
        hash5, _ := goimagehash.LoadExtImageHash(bar)
}

Release Note

v1.1.0

  • The performance of Perceptionhash is enhanced.

v1.0.3

  • Add workflow for GithubAction
  • Fix typo on the GoDoc for LoadImageHash

v1.0.2

  • go.mod is now used for install goimagehash

v1.0.1

  • Perception/ExtPerception hash creation times are reduced

v1.0.0

IMPORTANT goimagehash v1.0.0 does not have compatible with the before version for future features

v0.3.0

  • Support DifferenceHashExtend.
  • Support AverageHashExtend.
  • Support PerceptionHashExtend by @TokyoWolFrog.

v0.2.0

  • Perception Hash is updated.
  • Fix a critical bug of finding median value.

v0.1.0

  • Support Average hashing
  • Support Difference hashing
  • Support Perception hashing
  • Use bits.OnesCount64 for computing Hamming distance by @dominikh
  • Support hex serialization methods to ImageHash by @brunoro