Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whether phash is calculated correctly #1221

Open
chaserstrong opened this issue Apr 10, 2023 · 2 comments
Open

Whether phash is calculated correctly #1221

chaserstrong opened this issue Apr 10, 2023 · 2 comments
Labels
bug there is a bug in the way jimp behaves

Comments

@chaserstrong
Copy link

chaserstrong commented Apr 10, 2023

Expected Behavior

I have two pictures which look vary similar:
image
image

The original image link is below:
https://user-images.githubusercontent.com/18061322/230870421-1a6b4b6d-e2c3-42d6-be9a-4393a56166f2.png
https://user-images.githubusercontent.com/18061322/230870522-a20d7b6e-f2e5-4713-a3c9-b4e338ecf33f.png

And by the code, phash is 0.21875 which is too big in my opinion

Current Behavior

this is my code:

var imgUrls = require("./constant");
var Jimp = require("jimp");
(async () => {
  let img1 = await Jimp.read(imgUrls.closeIcon1);
  let img2 = await Jimp.read(imgUrls.closeIcon2);
  let hash1 = img1.pHash();
  let hash2 = img2.pHash();
  console.log(img2.distanceFromHash(hash1)); // 0.21875
  console.log(Jimp.diff(img1, img2).percent); // 0
})();

Failure Information (for bugs)

Steps to Reproduce

Screenshots

Context

  • Jimp Version:
  • Operating System:
  • Node version:

Failure Logs

@chaserstrong
Copy link
Author

@hipstersmoothie

@hipstersmoothie
Copy link
Collaborator

if you have a bug fix feel free to submit a pr!

@hipstersmoothie hipstersmoothie added the bug there is a bug in the way jimp behaves label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves
Projects
None yet
Development

No branches or pull requests

2 participants