jimp-dev / jimp-dev/jimp

Whether phash is calculated correctly

Open
#1,221 2 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

# 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.