3.0.1 • Published 1 year ago

imagehash-web v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

imagehash-web

npm

Javascript implementation of various image hashing algorithms.

npm install imagehash-web

The methods used to compute the image hashes the same as the imagehash python library. Due to some slight differences in the downsampling algorithm of your browser vs Pillow, the final image hashes are not always exactly the same as the reference library.

Implemented algorithms:

  • ahash Average hash
  • dhash Difference hash
  • phash Perceptual hash
  • whash Wavelet hash
  • cropResistantHash Crop resistant hash

Example usage (browser)

<script src="https://unpkg.com/imagehash-web/dist/imagehash-web.min.js"></script>
<script>
    const im = document.getElementById("my-image");

    const precomputed = ImageHash.fromHexString("5dbfb5310a81a361")
    
    phash(im, 8).then(hash => {
        console.log(hash.hammingDistance(precomputed));
    });
</script>

Example usage (NodeJS)

import {loadImage} from "canvas";
import {phash, ImageHash} from "imagehash-web";

const im = await loadImage("./my_image.jpg");

const hash = await phash(im, 8);
const precomputed = ImageHash.fromHexString("5dbfb5310a81a361")

console.log(hash.hammingDistance(precomputed));
3.0.1

1 year ago

3.0.0

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago