@browserless/screenshot 10.5.2 → 10.5.4

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.2",
5
+ "version": "10.5.4",
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": "~0.22.12",
37
+ "jimp": "~1.2.0",
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": "0cfe389ca008f8317df3237ec3a2f3a232eba849"
68
+ "gitHead": "f65b4f579d2ff9408ae9e8363202b8b2f5d14b9b"
69
69
  }
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
- const jimp = require('jimp')
3
+ const { Jimp } = require('jimp')
4
4
 
5
5
  module.exports = async uint8array => {
6
- const image = await jimp.read(Buffer.from(uint8array))
6
+ const image = await Jimp.fromBuffer(Buffer.from(uint8array))
7
7
  const firstPixel = image.getPixelColor(0, 0)
8
- const height = image.getHeight()
9
- const width = image.getWidth()
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