friendly-img-hash-js 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +4 -10
- package/package.json +4 -6
- package/src/url-resolver.js +2 -3
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Nodejs Example:
|
|
|
29
29
|
```
|
|
30
30
|
import { hash } from 'friendly-img-hash-js';
|
|
31
31
|
|
|
32
|
-
// Image formats supported are jpeg, png, webp, bitmap, tiff
|
|
32
|
+
// Image formats supported are jpeg, png, webp, bitmap, tiff, and avif
|
|
33
33
|
|
|
34
34
|
// Construct a hash!
|
|
35
35
|
const result = await hash('./some/file/on/disk.png');
|
package/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import { PNG } from 'pngjs';
|
|
|
5
5
|
import jpeg from 'jpeg-js';
|
|
6
6
|
import bmp from 'bmp-js';
|
|
7
7
|
import UTIF from 'utif2';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
import { avif, webp } from '@astropub/codecs';
|
|
9
10
|
|
|
10
11
|
import { getUrlData, isUrl } from './src/url-resolver.js';
|
|
11
12
|
import { reduceToRgb } from './src/byte-resolver.js';
|
|
@@ -24,15 +25,8 @@ const extToResolver = {
|
|
|
24
25
|
const rgba = UTIF.toRGBA8(ifds[0]); // Uint8Array with RGBA pixels
|
|
25
26
|
return { data: rgba, width: ifds[0].width, height: ifds[0].height };
|
|
26
27
|
},
|
|
27
|
-
webp:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const decoder = new WebPDecoder();
|
|
31
|
-
const tmp = { w: [], h: [] };
|
|
32
|
-
const data = decoder.WebPDecodeRGBA(raw, frames[0].src_off, frames[0].src_size, tmp.w, tmp.h);
|
|
33
|
-
|
|
34
|
-
return { data, width: tmp.w, height: tmp.h };
|
|
35
|
-
},
|
|
28
|
+
webp: webp.decode,
|
|
29
|
+
avif: avif.decode,
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
// Hash an image!
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "friendly-img-hash-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "User friendly algorithms for generating image hashes.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "mocha index.test.js",
|
|
8
|
+
"test": "mocha src/**/*.test.js index.test.js",
|
|
9
9
|
"lint": "eslint src/** index.js index.test.js --no-error-on-unmatched-pattern",
|
|
10
|
-
"lint:fix": "eslint src/** index.js index.test.js --fix"
|
|
11
|
-
"postinstall": "patch-package"
|
|
10
|
+
"lint:fix": "eslint src/** index.js index.test.js --fix"
|
|
12
11
|
},
|
|
13
12
|
"repository": {
|
|
14
13
|
"type": "git",
|
|
@@ -38,13 +37,12 @@
|
|
|
38
37
|
"mocha": "^10.2.0"
|
|
39
38
|
},
|
|
40
39
|
"dependencies": {
|
|
40
|
+
"@astropub/codecs": "^0.4.4",
|
|
41
41
|
"bmp-js": "^0.1.0",
|
|
42
42
|
"image-type": "^5.2.0",
|
|
43
43
|
"img-hash-js-core": "^1.0.7",
|
|
44
44
|
"jpeg-js": "^0.4.4",
|
|
45
|
-
"patch-package": "^8.0.0",
|
|
46
45
|
"pngjs": "^7.0.0",
|
|
47
|
-
"react-native-libwebpjs": "^1.0.0",
|
|
48
46
|
"utif2": "^4.1.0"
|
|
49
47
|
},
|
|
50
48
|
"browser": "browser.js"
|
package/src/url-resolver.js
CHANGED