2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-11 05:43:28 +00:00

Fix bug where GIF input would error on output.

Also minor corrections to jsdocs in ImageManipulation
This commit is contained in:
j433866
2019-03-20 11:20:34 +00:00
parent b312e17904
commit 6a01e40394
17 changed files with 118 additions and 26 deletions

View File

@@ -51,7 +51,13 @@ class DitherImage extends Operation {
if (ENVIRONMENT_IS_WORKER())
self.sendStatusMessage("Applying dither to image...");
image.dither565();
const imageBuffer = await image.getBufferAsync(jimp.AUTO);
let imageBuffer;
if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
} else {
imageBuffer = await image.getBufferAsync(jimp.AUTO);
}
return [...imageBuffer];
} catch (err) {
throw new OperationError(`Error applying dither to image. (${err})`);