@hackage perceptual-hash0.1.4.1

Find duplicate images

phash

Hackage CI Hackage Dependencies of latest version on Hackage

This is a Haskell library to detect (potential) duplicate images.

It also contains a command-line tool.

Use

Use it on one or more directories:

phash ~/Pictures ~/Downloads
~/Pictures/frog.jpeg, ~/Downloads/frog.png

Installation

Pre-Built Release

For many platforms, you can find binaries here.

Source

Download cabal-install and GHC. Then:

cabal install perceptual-hash --constraint='hip +disable-chart'

Library

You can find library documentation on Hackage.

Performance

This library has similar performance to the pHash library for PNG images.

benchmarking fileHash/cat.png
time                 20.67 ms   (20.60 ms .. 20.78 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 20.84 ms   (20.76 ms .. 21.01 ms)
std dev              246.3 μs   (149.5 μs .. 396.7 μs)

benchmarking fileHash/frog.jpeg
time                 17.82 ms   (17.62 ms .. 18.05 ms)
                     0.999 R²   (0.999 R² .. 1.000 R²)
mean                 17.54 ms   (17.45 ms .. 17.65 ms)
std dev              272.3 μs   (194.9 μs .. 369.3 μs)

benchmarking fileHash/frog.png
time                 12.02 ms   (11.95 ms .. 12.11 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 12.08 ms   (12.04 ms .. 12.13 ms)
std dev              115.0 μs   (90.79 μs .. 144.7 μs)

benchmarking foreignHash/cat.png
time                 18.86 ms   (18.79 ms .. 18.97 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 18.92 ms   (18.87 ms .. 18.99 ms)
std dev              149.7 μs   (129.0 μs .. 183.6 μs)

benchmarking foreignHash/frog.jpeg
time                 8.533 ms   (8.480 ms .. 8.574 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 8.686 ms   (8.644 ms .. 8.745 ms)
std dev              129.0 μs   (97.99 μs .. 164.8 μs)

benchmarking foreignHash/frog.png
time                 9.697 ms   (9.649 ms .. 9.735 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 9.746 ms   (9.717 ms .. 9.775 ms)
std dev              84.08 μs   (70.14 μs .. 97.91 μs)

Foreign Library

This package contains a foreign library and a header file

ATS Bindings

Because of the foreign library, hs_phash can be used in ATS as well. ATS users of the library may be interested in hs-bind.