Hash an image based on what it looks like, Image Hash is intended to be used for identifying duplicate images. Currently supports JPEG and PNG image formats.
I have a lot of reaction images and pictures saved from Reddit/4Chan etc. When it's time to do a spring clean of my files I like to delete duplicate images. And that's how this project was born.
To get the hash of an image run:
$ image-hash /path/to/picture.jpg fe1d10cc65aa0bad
You can hash multiple images as well:
$ image-hash cat.jpg house.jpg fe1d10cc65aa0bad 15496b40ebe0fc82
-v flag to get the image paths as well as their hashes:
$ image-hash -v cat.jpg house.jpg cat.jpg fe1d10cc65aa0bad house.jpg 15496b40ebe0fc82
You can also read images from
stdin such as:
$ ls *.jpg | image-hash -v cat.jpg fe1d10cc65aa0bad house.jpg 15496b40ebe0fc82
With a set up Go environment simply:
go install github.com/brgmnn/image-hash
Command line flags
-b, -bitdepth =
The bitdepth represents the image bitdepth to rescale to.
Images are converted from colour to
bitdepth grayscale. Defaults to 5.
-hl, -hashlength =
The length of image hashes in bytes. When reducing the length of a hash, extra bytes are bitwise XORed into the hash. Defaults to 8.
-j, -jobs =
The maximum number of hashing jobs to run in parallel. Must be at least 1 and
no more than 128. Defaults to the number of CPU cores on the machine as
provided by golang's
Passing this flag writes error messages to stderr when
image-hash fails to
hash an image. By default failed images are silently ignored.
-s, -size =
The target image size in pixels when rescaling images. All
images are rescaled to have a width of
size. Images keep their aspect ratio
and so may have differing heights, but all images are rescaled to the same
width. Defaults to 4.
Print the image paths as well as their hashes.
Image Hash depends on nfnt/resize which requires at least Go 1.1.