Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alttiri/image-hash

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alttiri/image-hash

Alt-Image-Hash. An alternative image hashing library.

  • 0.0.2-20241214
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Alt-Image-Hash

Alternative JavaScript image hashing library.

Supported perceptual hashes:

  • dHash (difference hash)
  • aHash (average hash)
  • mHash (median hash)
  • bHash (block hash)

Basic examples

import {getImageDataWithSharp as getImageData} from "@alttiri/get-image-data";
import {dHash} from "@alttiri/image-hash";

const imagePath = "alyson_hannigan_500x500.jpg";
const imageData = await getImageData(imagePath);
const hash = dHash(imageData);
console.log(hash.hex); // "8f94b43434245452"
const hash1 = dHash(await getImageData("kittens-3264x2448.jpg"));
const hash2 = dHash(await getImageData("kittens-960x720.jpg"));

console.log(hash1.hex); // "e020acce864cae8a"
console.log(hash2.hex); // "e020acce864cae8a"
console.log(hash1.diff(hash2)); // 0

Keywords

FAQs

Package last updated on 14 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc