# blockhash

> Perceptual image hash calculation tool

Latest version **0.2.0** (published 2014-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install blockhash
pnpm add blockhash
yarn add blockhash
bun add blockhash
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2014-12-02 |
| First published | 2014-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 176 |
| Author | Commons Machinery |
| Maintainers | commonsmachinery |
| Keywords | image, hashing, perceptual |

## Links

- npm: https://www.npmjs.com/package/blockhash
- Repository: https://github.com/commonsmachinery/blockhash-js
- Issues: https://github.com/commonsmachinery/blockhash-js/issues
- npm.io page: https://npm.io/package/blockhash

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2014-12-02

## 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-js
```

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:
```html
<!DOCTYPE html>
<html>
  <head>
    <title>Blockhash</title>
  </head>
  <body>
    <script src="node_modules/png-js/zlib.js"></script>
    <script src="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

---
_Source: https://npm.io/package/blockhash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
