# blockhash-core

> This is the core implementation of the [blockhash perceptual image hashing algorithm](http://blockhash.io).

Latest version **0.1.0** (published 2019-12-07) · MIT license · 0 weekly downloads

## Install

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

## 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.1.0 |
| Published | 2019-12-07 |
| First published | 2019-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Maintainers | linusu |

## Links

- npm: https://www.npmjs.com/package/blockhash-core
- Repository: https://github.com/LinusU/blockhash-core
- Homepage: https://github.com/LinusU/blockhash-core#readme
- Issues: https://github.com/LinusU/blockhash-core/issues
- npm.io page: https://npm.io/package/blockhash-core

## Recent versions

- 0.1.0 (latest) — 2019-12-07

## README

# Blockhash Core

This is the core implementation of the [blockhash perceptual image hashing algorithm](http://blockhash.io).

Look at the main [`blockhash` package](https://github.com/commonsmachinery/blockhash-js) if you want a higher level api.

## Installation

```sh
npm install --save blockhash-core
```

## Usage

```js
const { bmvbhash } = require('blockhash')

const image = new ImageData(/* ... */)
const result = bmvbhash(image, 16)

console.log(result)
//=> f81bf99ffb803400e07f8c5d849f049707033a033fe33fe1bfe00e618ee30ca7
```

## API

### `bmvbhash(data, bits)`

- `data` ([`ImageData`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData), required) - The input image data
- `bits` (`number`, required) - Create hash of size N^2 bits
- returns `string` - The resulting hash in hex format

Precise 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`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData), required) - The input image data
- `bits` (`number`, required) - Create hash of size N^2 bits
- returns `string` - The resulting hash in hex format

Quick 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.

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