mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Remove duplicate function.
Fix reading QR codes with transparent backgrounds
This commit is contained in:
parent
be08a62f52
commit
1135ca5fb4
2 changed files with 2 additions and 16 deletions
|
@ -594,22 +594,6 @@ class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a string to an ArrayBuffer.
|
|
||||||
*
|
|
||||||
* @param {string} string
|
|
||||||
*/
|
|
||||||
static strToArrayBuffer(string) {
|
|
||||||
const arrayBuffer = new ArrayBuffer(string.length * 2);
|
|
||||||
const arrayBufferView = new Uint8Array(arrayBuffer);
|
|
||||||
for (let i = 0; i < string.length; i++) {
|
|
||||||
arrayBufferView[i] = string.charCodeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return arrayBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses CSV data and returns it as a two dimensional array or strings.
|
* Parses CSV data and returns it as a two dimensional array or strings.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,6 +33,8 @@ export async function parseQrCode(input, normalise) {
|
||||||
image.background(0xFFFFFFFF);
|
image.background(0xFFFFFFFF);
|
||||||
image.normalize();
|
image.normalize();
|
||||||
image.greyscale();
|
image.greyscale();
|
||||||
|
image = await image.getBufferAsync(jimp.MIME_JPEG);
|
||||||
|
image = await jimp.read(image);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new OperationError(`Error normalising iamge. (${err})`);
|
throw new OperationError(`Error normalising iamge. (${err})`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue