Skip to content

Ruby wrapper around pHash, the perceptual hash library for detecting duplicate multimedia files

License

Notifications You must be signed in to change notification settings

lemurheavy/phashion

 
 

Repository files navigation

Phashion

Phashion is a Ruby wrapper around the pHash library, "perceptual hash", which detects duplicate and near duplicate multimedia files (images, audio, video). The wrapper currently only supports images.

See an overview of Phashion on my blog.

Installation

You install it just like any other Ruby gem:

gem install phashion

Phashion is somewhat involved to install as it has a few dependencies. I've wrapped up those dependencies into a custom tarball that is built locally just for this gem so you don't have to do anything special. See the code in ext/phashion_ext for more details.

Because of this complexity, it is possible the gem install will fail on your platform. I've tested it on Mac OSX 10.6 and Ubuntu 8.04 but please contact me if you have installation problems.

If you have an error upon install, like:

ld: library not found for -ljpeg

you need to install libjpeg. "brew install libjpeg" or "port install jpeg" on OSX.

Usage

require 'phashion'
img1 = Phashion::Image.new(filename1)
img2 = Phashion::Image.new(filename2)
img1.duplicate?(img2)

# mexican hat wavelet algorithm usage:
img1.duplicate?(img2, :mh)
--> true

Author

Mike Perham, http://mikeperham.com, http://twitter.com/mperham, mperham AT gmail.com

Copyright

Copyright (c) 2010 Mike Perham. See LICENSE for details.

About

Ruby wrapper around pHash, the perceptual hash library for detecting duplicate multimedia files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 79.4%
  • C 20.6%