mirror of
https://github.com/gchq/CyberChef
synced 2025-12-21 10:43:18 +00:00
Fix bug where GIF input would error on output.
Also minor corrections to jsdocs in ImageManipulation
This commit is contained in:
@@ -51,7 +51,13 @@ class InvertImage extends Operation {
|
||||
if (ENVIRONMENT_IS_WORKER())
|
||||
self.sendStatusMessage("Inverting image...");
|
||||
image.invert();
|
||||
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 inverting image. (${err})`);
|
||||
|
||||
Reference in New Issue
Block a user