npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

image_phash

v1.1.1

Published

Perceptual Hash,be used to find similar image

Downloads

8

Readme

pHash

感知哈希算法的node实现,该算法主要用于提取媒体文件的特征值,可用于识别媒体文件。 但特征值与媒体文件之间并不是唯一对应。一般使用该算法来找出重复的媒体文件。

模块的C++部分使用了pHash提供的C++库,并在其上做了精简,去除了用不到的部分。

目前这个模块只用于处理图片

A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. You can use it to find simillar image. The main C++ code is from pHash,and I deleted some code that will not be used.Such as the code of trying to load image by built-in jpeglib ,and the code that deal with text and video.etc. This module mainly deals with images .And I removed the error that throw out by 'CImg.h',This change avoids the crash of your process when the CImg Object try to throw an error!

The module works well if you have install imageMagick or GraphicsMagick correctly. And I have tested this module in windows(win10) and linux(ubutun).

Installation

首先请安装imageMagick 或者GraphicsMagick, 可以使用另一个模块gm来验证是否安装正确。

At first ,please install imageMagick or GraphicsMagick,you can use gm to verify the installation.

  npm install image_phash

Useage


   var image_phash=require("image_phash");
   
   var hash1=image_phash.imageHashSync("./test1.png"),//return the DCT Image Hash
       hash2=image_phash.imageHashSync("./test2.jpg");//maybe you need to storage 
	   //it for search
	   
   var hamming_distance=image_phash.Hamming_distance(hash1,hash2);//maybe you want 
   //use a different threshold to judge the images
   
   var is_similar=image_phash.isSimilar(hash1,hash2);//Threshold set to 26.00. this 
   //function return a boolean value,while 'true' means these two image is similar!