change a function name

This commit is contained in:
JasterV 2022-03-21 16:18:04 +01:00
parent 3e9c0b5dca
commit f9592db33f
2 changed files with 5 additions and 5 deletions

View file

@ -43,8 +43,8 @@ const image = new HashImage(buffer)
```javascript
const image1 = await HashImage.fromUrl(url1);
const image2 = await HashImage.fromUrl(url2);
const hash1 = await image1.hash() // PHash instance
const hash2 = await image2.hash()
const hash1 = await image1.phash() // PHash instance
const hash2 = await image2.phash()
const similarity = hash1.compare(hash2)
```

View file

@ -24,7 +24,7 @@ class HashImage {
}
}
async hash() {
async phash() {
const data = await imageFromBuffer(this.buffer);
const hexHash = await blockhash.bmvbhash(getImageData(data), 8);
const hash = hexToBin(hexHash);
@ -35,8 +35,8 @@ class HashImage {
if (!(other instanceof HashImage)) {
throw new Error("Can't compare with a non HashImage value");
}
const hash1 = await this.hash();
const hash2 = await other.hash();
const hash1 = await this.phash();
const hash2 = await other.phash();
return hash1.compare(hash2);
}
}