Comparing version 9.2.1 to 9.3.0
@@ -13,2 +13,5 @@ import { QR } from "./qr-base.js"; | ||
const imageSize = matrix.length * size + marginPx * 2; | ||
if (size > 200) { | ||
throw new Error('Module size is too big, resulting image is too large: ' + imageSize); | ||
} | ||
const svg = await createSVG({ | ||
@@ -29,5 +32,7 @@ matrix, size, margin, color, bgColor, | ||
} | ||
const { data } = await qrImage.png().toBuffer({ resolveWithObject: true }); | ||
const { data } = await qrImage.png({ | ||
palette: !logo, | ||
}).toBuffer({ resolveWithObject: true }); | ||
return new Uint8ClampedArray(data.buffer); | ||
} | ||
//# sourceMappingURL=png.js.map |
@@ -232,3 +232,3 @@ import test from "ava"; | ||
filename: "qr_large.png", | ||
params: { size: 300, margin: 10 }, | ||
params: { size: 199, margin: 10 }, | ||
} | ||
@@ -235,0 +235,0 @@ ].forEach((testData) => { |
{ | ||
"name": "qreator", | ||
"version": "9.2.1", | ||
"version": "9.3.0", | ||
"description": "QR Code generator for browser and node.js with tree shaking and logo support", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Short-io/qreator", |
@@ -26,2 +26,5 @@ import { ImageOptions, Matrix } from "./typing/types"; | ||
const imageSize = matrix.length * size + marginPx * 2; | ||
if (size > 200) { | ||
throw new Error('Module size is too big, resulting image is too large: ' + imageSize); | ||
} | ||
const svg = await createSVG({ | ||
@@ -42,4 +45,6 @@ matrix, size, margin, color, bgColor, | ||
} | ||
const { data } = await qrImage.png().toBuffer({ resolveWithObject: true}); | ||
const { data } = await qrImage.png({ | ||
palette: !logo, // no logo results in much less colors | ||
}).toBuffer({ resolveWithObject: true}); | ||
return new Uint8ClampedArray(data.buffer); | ||
} |
@@ -245,3 +245,3 @@ import test from "ava"; | ||
filename: "qr_large.png", | ||
params: { size: 300, margin: 10 }, | ||
params: { size: 199, margin: 10 }, | ||
} | ||
@@ -248,0 +248,0 @@ ] as TestParams[]).forEach((testData) => { |
Sorry, the diff of this file is not supported yet
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
3799350
32283