MCPcopy Index your code
hub / github.com/commonsmachinery/blockhash-js

github.com/commonsmachinery/blockhash-js @v0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3 ↗ · + Follow
8 symbols 17 edges 3 files 0 documented · 0% updated 5y agov0.3 · 2017-11-28★ 17513 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

blockhash-js

This is a perceptual image hash calculation tool based on algorithm descibed in Block Mean Value Based Image Perceptual Hashing by Bian Yang, Fan Gu and Xiamu Niu.

Installation

This module is installed via npm:

  $ npm install blockhash

Use in the browser

To use this library in the browser, you can build it with Browserify with something like browserify index.js --standalone blockhashjs > blockhash.js

Include it and zlib.js on your page:

<!DOCTYPE html>
<html>
  <head>
    <title>Blockhash</title>
  </head>
  <body>
    <script src="https://github.com/commonsmachinery/blockhash-js/raw/v0.3/node_modules/png-js/zlib.js"></script>
    <script src="https://github.com/commonsmachinery/blockhash-js/raw/v0.3/blockhash.js"></script>
    <script>
      var blockhash = blockhashjs.blockhash;
    </script>
  </body>
</html>

Call blockhash(src, bits, method, callback), where src is an image URL, bits is the number of bits in a row, method is a number 1-2 (see below), and callback is a function with (error, result) signature. On success, result will be array of binary values.

The available methods are:

  1. Quick and crude, non-overlapping blocks
  2. Precise but slower, non-overlapping blocks

Method 2 is recommended as a good tradeoff between speed and good matches on any image size. The quick ones are only advisable when the image width and height are an even multiple of the number of blocks used.

License

Copyright 2014 Commons Machinery http://commonsmachinery.se/

Distributed under an MIT license, please see LICENSE in the top dir.

Contact: dev@commonsmachinery.se

Core symbols most depended-on inside this repo

translate_blocks_to_bits
called by 2
index.js
bits_to_hexhash
called by 2
index.js
bmvbhash_even
called by 2
index.js
median
called by 1
index.js
bmvbhash
called by 1
index.js
blockhashData
called by 1
index.js
hammingDistance
called by 0
index.js
blockhash
called by 0
index.js

Shape

Function 8

Languages

TypeScript100%

Modules by API surface

index.js8 symbols

For agents

$ claude mcp add blockhash-js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page