Core implementation of the blockhash perceptual image hashing algorithm
MIT License
This is the core implementation of the blockhash perceptual image hashing algorithm.
Look at the main blockhash
package if you want a higher level api.
npm install --save blockhash-core
const { bmvbhash } = require('blockhash-core')
const image = new ImageData(/* ... */)
const result = bmvbhash(image, 16)
console.log(result)
//=> f81bf99ffb803400e07f8c5d849f049707033a033fe33fe1bfe00e618ee30ca7
bmvbhash(data, bits)
data
(ImageData
, required) - The input image databits
(number
, required) - Create hash of size N^2 bitsstring
- The resulting hash in hex formatPrecise but slower, non-overlapping blocks.
This method is recommended as a good tradeoff between speed and good matches on any image size.
bmvbhashEven(data, bits)
data
(ImageData
, required) - The input image databits
(number
, required) - Create hash of size N^2 bitsstring
- The resulting hash in hex formatQuick and crude, non-overlapping blocks.
This method is only advisable when the image width and height are an even multiple of the number of blocks used.