Project

dcthash

0.0
Low commit activity in last 3 years
No release in over a year
This is a perceptual image hash calculation and comparison tool. This can be used to match compressed or resized images to each other.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.0
 Project Readme

DCTHash

This is Ruby Gem that can be used to produce and compare perceptual image hashes.

Installation

Prerequisites

On Debian/Ubuntu/Mint, you can run:

sudo apt get install libmagickwand-dev

On Arch you can run:

pacman -Sy pkg-config imagemagick

On macOS, you can run:

brew install pkg-config imagemagick

Gem Install

Install via Bundler

bundle add dcthash

Or install via RubyGems:

gem install dcthash

Usage

require "dcthash"
require "rmagick"

image1 = Magick::Image.read("image1.png").first
image2 = Magick::Image.read("image2.png").first

# Generate image hashes
hash1 = Dcthash.calculate(image1)
hash2 = Dcthash.calculate(image2)

# Determine if hashes are similar
similar = Dcthash.similar?(hash1, hash2, threshold = 13)

# Calculate difference between two hashes
distance = Dcthash.distance(hash1, hash2)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/actuallydamo/dcthash.

License

The gem is available as open source under the terms of the MIT License.