@applitools/image
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -35,2 +35,3 @@ "use strict"; | ||
const jpeg = __importStar(require("jpeg-js")); | ||
const bmp = __importStar(require("bmpimagejs")); | ||
const utils = __importStar(require("@applitools/utils")); | ||
@@ -55,2 +56,6 @@ function makeImage(data) { | ||
} | ||
else if (isBmpBuffer(data)) { | ||
image = fromBmpBuffer(data); | ||
size = extractBmpSize(data); | ||
} | ||
else { | ||
@@ -204,2 +209,5 @@ throw new Error('Unable to create an image abstraction from buffer with unknown data'); | ||
} | ||
function isBmpBuffer(buffer) { | ||
return buffer.slice(0, 2).toString('ascii') === 'BM'; | ||
} | ||
function extractPngSize(buffer) { | ||
@@ -224,2 +232,5 @@ return { width: buffer.readUInt32BE(16), height: buffer.readUInt32BE(20) }; | ||
} | ||
function extractBmpSize(buffer) { | ||
return { width: buffer.readUInt32LE(18), height: buffer.readUInt32LE(22) }; | ||
} | ||
function fromSize(size) { | ||
@@ -241,2 +252,6 @@ return new png.Image({ width: size.width, height: size.height }); | ||
} | ||
async function fromBmpBuffer(buffer) { | ||
const image = bmp.decode(buffer); | ||
return { data: Buffer.from(image.pixels), width: image.width, height: image.height }; | ||
} | ||
async function toPng(image) { | ||
@@ -243,0 +258,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "@applitools/image", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Image primitive used for capturing and manipulating screenshots", | ||
@@ -47,3 +47,4 @@ "homepage": "https://applitools.com", | ||
"dependencies": { | ||
"@applitools/utils": "1.3.13", | ||
"@applitools/utils": "1.3.14", | ||
"bmpimagejs": "1.0.4", | ||
"jpeg-js": "0.4.4", | ||
@@ -55,2 +56,3 @@ "png-async": "0.9.4" | ||
"@applitools/scripts": "^1.2.0", | ||
"@types/bmp-js": "^0.1.0", | ||
"@types/mocha": "^9.1.1", | ||
@@ -70,3 +72,3 @@ "@types/node": "12", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.6.4" | ||
"typescript": "^4.8.4" | ||
}, | ||
@@ -73,0 +75,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45984
711
4
18
+ Addedbmpimagejs@1.0.4
+ Added@applitools/utils@1.3.14(transitive)
+ Addedbmpimagejs@1.0.4(transitive)
- Removed@applitools/utils@1.3.13(transitive)
Updated@applitools/utils@1.3.14