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

imglookalike

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imglookalike

small module to calculate if 2 images look alike using perceptual hash Hamming distance and Levenshtein distance

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

image look alike

Installation

npm install imglookalike

Usage

Note: as of now it has been with .png and .jpg file formats

const imglookalike = require('imglookalike')

imglookalike.compare('path/to/img1.png', 'path/to/img2.jpg')
    .then((result) =>{
        /*210 
        Do something based on that result
        */
    })

// increase precision by changing the number of bits of the hash
imglookalike.compare('path/to/img1.png', path/to/img2.jpg, {nBits : 16})
// select which comparison algorith to run (hamming or levenshtein)
imglookalike.compare('path/to/img1.png', path/to/img2.jpg, {algorithm : "hamming"})

API

compare(pathImg1, pathImg2, options)

compare two images

pathImg1 & 2

Type: string

The path of the images you want to compare.

options

Type: object

nBits

Type: number
Default: 8

The numbers of bits you wish the hash would be Note: the result of nBits % 4 must be 0 E.g (16 % 4 = 0, 6 % 4 = 2)

algorithm

Type: string
Default: levenshtein

The algorithm to use for the distance calculation either hamming or levenshtein

Keywords

FAQs

Package last updated on 23 May 2021

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