@browserless/screenshot 10.5.2 → 10.5.3
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/screenshot",
|
|
3
3
|
"description": "Take a clean screenshot of any website",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=screenshoturl-options",
|
|
5
|
-
"version": "10.5.
|
|
5
|
+
"version": "10.5.3",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"got": "~11.8.6",
|
|
35
35
|
"is-html-content": "~1.0.0",
|
|
36
36
|
"is-url-http": "~2.3.7",
|
|
37
|
-
"jimp": "~
|
|
37
|
+
"jimp": "~1.1.2",
|
|
38
38
|
"map-values-deep": "~1.0.2",
|
|
39
39
|
"mime": "~3.0.0",
|
|
40
40
|
"p-reflect": "~2.1.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"timeout": "2m",
|
|
66
66
|
"workerThreads": false
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "e1ca16c0a84a7b4618b9ef05c9aba966cb16b1f5"
|
|
69
69
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { Jimp } = require('jimp')
|
|
4
4
|
|
|
5
5
|
module.exports = async uint8array => {
|
|
6
|
-
const image = await
|
|
6
|
+
const image = await Jimp.fromBuffer(Buffer.from(uint8array))
|
|
7
7
|
const firstPixel = image.getPixelColor(0, 0)
|
|
8
|
-
const height = image.
|
|
9
|
-
const width = image.
|
|
8
|
+
const height = image.bitmap.height
|
|
9
|
+
const width = image.bitmap.width
|
|
10
10
|
|
|
11
11
|
const samplePercentage = 0.25 // Sample 25% of the image
|
|
12
12
|
const sampleSize = Math.floor(width * height * samplePercentage) // Calculate sample size based on percentage
|