mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Merge branch 'master' into feat/support-other-keys-in-parse-csr
This commit is contained in:
commit
4528a1bdb6
37 changed files with 2946 additions and 1933 deletions
|
@ -30,12 +30,12 @@ fs.readdirSync(path.join(dir, "../operations")).forEach(file => {
|
|||
|
||||
// Construct index file
|
||||
let code = `/**
|
||||
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateOpsIndex.mjs
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright ${new Date().getUTCFullYear()}
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateOpsIndex.mjs
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright ${new Date().getUTCFullYear()}
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
`;
|
||||
|
||||
opObjs.forEach(obj => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import jsQR from "jsqr";
|
||||
import qr from "qr-image";
|
||||
import Utils from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Parses a QR code image from an image
|
||||
|
@ -22,7 +22,7 @@ import jimp from "jimp";
|
|||
export async function parseQrCode(input, normalise) {
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error opening image. (${err})`);
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ export async function parseQrCode(input, normalise) {
|
|||
image.background(0xFFFFFFFF);
|
||||
image.normalize();
|
||||
image.greyscale();
|
||||
image = await image.getBufferAsync(jimp.MIME_JPEG);
|
||||
image = await jimp.read(image);
|
||||
image = await image.getBufferAsync(Jimp.MIME_JPEG);
|
||||
image = await Jimp.read(image);
|
||||
}
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error normalising image. (${err})`);
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Add Text To Image operation
|
||||
|
@ -127,7 +127,7 @@ class AddTextToImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class AddTextToImage extends Operation {
|
|||
const font = fontsMap[fontFace];
|
||||
|
||||
// LoadFont needs an absolute url, so append the font name to self.docURL
|
||||
const jimpFont = await jimp.loadFont(self.docURL + "/" + font.default);
|
||||
const jimpFont = await Jimp.loadFont(self.docURL + "/" + font.default);
|
||||
|
||||
jimpFont.pages.forEach(function(page) {
|
||||
if (page.bitmap) {
|
||||
|
@ -190,7 +190,7 @@ class AddTextToImage extends Operation {
|
|||
});
|
||||
|
||||
// Create a temporary image to hold the rendered text
|
||||
const textImage = new jimp(jimp.measureText(jimpFont, text), jimp.measureTextHeight(jimpFont, text));
|
||||
const textImage = new Jimp(Jimp.measureText(jimpFont, text), Jimp.measureTextHeight(jimpFont, text));
|
||||
textImage.print(jimpFont, 0, 0, text);
|
||||
|
||||
// Scale the rendered text image to the correct size
|
||||
|
@ -198,9 +198,9 @@ class AddTextToImage extends Operation {
|
|||
if (size !== 1) {
|
||||
// Use bicubic for decreasing size
|
||||
if (size > 1) {
|
||||
textImage.scale(scaleFactor, jimp.RESIZE_BICUBIC);
|
||||
textImage.scale(scaleFactor, Jimp.RESIZE_BICUBIC);
|
||||
} else {
|
||||
textImage.scale(scaleFactor, jimp.RESIZE_BILINEAR);
|
||||
textImage.scale(scaleFactor, Jimp.RESIZE_BILINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,9 @@ class AddTextToImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { isWorkerEnvironment } from "../Utils.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Blur Image operation
|
||||
|
@ -59,7 +59,7 @@ class BlurImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ class BlurImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Contain Image operation
|
||||
|
@ -91,20 +91,20 @@ class ContainImage extends Operation {
|
|||
const [width, height, hAlign, vAlign, alg, opaqueBg] = args;
|
||||
|
||||
const resizeMap = {
|
||||
"Nearest Neighbour": jimp.RESIZE_NEAREST_NEIGHBOR,
|
||||
"Bilinear": jimp.RESIZE_BILINEAR,
|
||||
"Bicubic": jimp.RESIZE_BICUBIC,
|
||||
"Hermite": jimp.RESIZE_HERMITE,
|
||||
"Bezier": jimp.RESIZE_BEZIER
|
||||
"Nearest Neighbour": Jimp.RESIZE_NEAREST_NEIGHBOR,
|
||||
"Bilinear": Jimp.RESIZE_BILINEAR,
|
||||
"Bicubic": Jimp.RESIZE_BICUBIC,
|
||||
"Hermite": Jimp.RESIZE_HERMITE,
|
||||
"Bezier": Jimp.RESIZE_BEZIER
|
||||
};
|
||||
|
||||
const alignMap = {
|
||||
"Left": jimp.HORIZONTAL_ALIGN_LEFT,
|
||||
"Center": jimp.HORIZONTAL_ALIGN_CENTER,
|
||||
"Right": jimp.HORIZONTAL_ALIGN_RIGHT,
|
||||
"Top": jimp.VERTICAL_ALIGN_TOP,
|
||||
"Middle": jimp.VERTICAL_ALIGN_MIDDLE,
|
||||
"Bottom": jimp.VERTICAL_ALIGN_BOTTOM
|
||||
"Left": Jimp.HORIZONTAL_ALIGN_LEFT,
|
||||
"Center": Jimp.HORIZONTAL_ALIGN_CENTER,
|
||||
"Right": Jimp.HORIZONTAL_ALIGN_RIGHT,
|
||||
"Top": Jimp.VERTICAL_ALIGN_TOP,
|
||||
"Middle": Jimp.VERTICAL_ALIGN_MIDDLE,
|
||||
"Bottom": Jimp.VERTICAL_ALIGN_BOTTOM
|
||||
};
|
||||
|
||||
if (!isImage(input)) {
|
||||
|
@ -113,7 +113,7 @@ class ContainImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -123,16 +123,16 @@ class ContainImage extends Operation {
|
|||
image.contain(width, height, alignMap[hAlign] | alignMap[vAlign], resizeMap[alg]);
|
||||
|
||||
if (opaqueBg) {
|
||||
const newImage = await jimp.read(width, height, 0x000000FF);
|
||||
const newImage = await Jimp.read(width, height, 0x000000FF);
|
||||
newImage.blit(image, 0, 0);
|
||||
image = newImage;
|
||||
}
|
||||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Convert Image Format operation
|
||||
|
@ -76,19 +76,19 @@ class ConvertImageFormat extends Operation {
|
|||
async run(input, args) {
|
||||
const [format, jpegQuality, pngFilterType, pngDeflateLevel] = args;
|
||||
const formatMap = {
|
||||
"JPEG": jimp.MIME_JPEG,
|
||||
"PNG": jimp.MIME_PNG,
|
||||
"BMP": jimp.MIME_BMP,
|
||||
"TIFF": jimp.MIME_TIFF
|
||||
"JPEG": Jimp.MIME_JPEG,
|
||||
"PNG": Jimp.MIME_PNG,
|
||||
"BMP": Jimp.MIME_BMP,
|
||||
"TIFF": Jimp.MIME_TIFF
|
||||
};
|
||||
|
||||
const pngFilterMap = {
|
||||
"Auto": jimp.PNG_FILTER_AUTO,
|
||||
"None": jimp.PNG_FILTER_NONE,
|
||||
"Sub": jimp.PNG_FILTER_SUB,
|
||||
"Up": jimp.PNG_FILTER_UP,
|
||||
"Average": jimp.PNG_FILTER_AVERAGE,
|
||||
"Paeth": jimp.PNG_FILTER_PATH
|
||||
"Auto": Jimp.PNG_FILTER_AUTO,
|
||||
"None": Jimp.PNG_FILTER_NONE,
|
||||
"Sub": Jimp.PNG_FILTER_SUB,
|
||||
"Up": Jimp.PNG_FILTER_UP,
|
||||
"Average": Jimp.PNG_FILTER_AVERAGE,
|
||||
"Paeth": Jimp.PNG_FILTER_PATH
|
||||
};
|
||||
|
||||
const mime = formatMap[format];
|
||||
|
@ -98,7 +98,7 @@ class ConvertImageFormat extends Operation {
|
|||
}
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error opening image file. (${err})`);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Cover Image operation
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Crop Image operation
|
||||
|
@ -99,7 +99,7 @@ class CropImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ class CropImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Image Dither operation
|
||||
|
@ -44,7 +44,7 @@ class DitherImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ class DitherImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import Utils from "../Utils.mjs";
|
||||
import { fromBinary } from "../lib/Binary.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Extract LSB operation
|
||||
|
@ -73,7 +73,7 @@ class ExtractLSB extends Operation {
|
|||
const bit = 7 - args.pop(),
|
||||
pixelOrder = args.pop(),
|
||||
colours = args.filter(option => option !== "").map(option => COLOUR_OPTIONS.indexOf(option)),
|
||||
parsedImage = await jimp.read(input),
|
||||
parsedImage = await Jimp.read(input),
|
||||
width = parsedImage.bitmap.width,
|
||||
height = parsedImage.bitmap.height,
|
||||
rgba = parsedImage.bitmap.data;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ExtractRGBA extends Operation {
|
|||
|
||||
const delimiter = args[0],
|
||||
includeAlpha = args[1],
|
||||
parsedImage = await jimp.read(input);
|
||||
parsedImage = await Jimp.read(input);
|
||||
|
||||
let bitmap = parsedImage.bitmap.data;
|
||||
bitmap = includeAlpha ? bitmap : bitmap.filter((val, idx) => idx % 4 !== 3);
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Flip Image operation
|
||||
|
@ -51,7 +51,7 @@ class FlipImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ class FlipImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import Utils from "../Utils.mjs";
|
|||
import {isImage} from "../lib/FileType.mjs";
|
||||
import {toBase64} from "../lib/Base64.mjs";
|
||||
import {isWorkerEnvironment} from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Generate Image operation
|
||||
|
@ -81,7 +81,7 @@ class GenerateImage extends Operation {
|
|||
}
|
||||
|
||||
const height = Math.ceil(input.length / bytesPerPixel / width);
|
||||
const image = await new jimp(width, height, (err, image) => {});
|
||||
const image = await new Jimp(width, height, (err, image) => {});
|
||||
|
||||
if (isWorkerEnvironment())
|
||||
self.sendStatusMessage("Generating image from data...");
|
||||
|
@ -95,7 +95,7 @@ class GenerateImage extends Operation {
|
|||
const y = Math.floor(index / width);
|
||||
|
||||
const value = curByte[k] === "0" ? 0xFF : 0x00;
|
||||
const pixel = jimp.rgbaToInt(value, value, value, 0xFF);
|
||||
const pixel = Jimp.rgbaToInt(value, value, value, 0xFF);
|
||||
image.setPixelColor(pixel, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class GenerateImage extends Operation {
|
|||
}
|
||||
|
||||
try {
|
||||
const pixel = jimp.rgbaToInt(red, green, blue, alpha);
|
||||
const pixel = Jimp.rgbaToInt(red, green, blue, alpha);
|
||||
image.setPixelColor(pixel, x, y);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error while generating image from pixel values. (${err})`);
|
||||
|
@ -151,11 +151,11 @@ class GenerateImage extends Operation {
|
|||
if (isWorkerEnvironment())
|
||||
self.sendStatusMessage("Scaling image...");
|
||||
|
||||
image.scaleToFit(width*scale, height*scale, jimp.RESIZE_NEAREST_NEIGHBOR);
|
||||
image.scaleToFit(width*scale, height*scale, Jimp.RESIZE_NEAREST_NEIGHBOR);
|
||||
}
|
||||
|
||||
try {
|
||||
const imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
const imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error generating image. (${err})`);
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Image Brightness / Contrast operation
|
||||
|
@ -60,7 +60,7 @@ class ImageBrightnessContrast extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ class ImageBrightnessContrast extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Image Filter operation
|
||||
|
@ -54,7 +54,7 @@ class ImageFilter extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ class ImageFilter extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Image Hue/Saturation/Lightness operation
|
||||
|
@ -68,7 +68,7 @@ class ImageHueSaturationLightness extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ class ImageHueSaturationLightness extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Image Opacity operation
|
||||
|
@ -53,7 +53,7 @@ class ImageOpacity extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ class ImageOpacity extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Invert Image operation
|
||||
|
@ -44,7 +44,7 @@ class InvertImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ class InvertImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -35,12 +35,6 @@ class JPathExpression extends Operation {
|
|||
name: "Result delimiter",
|
||||
type: "binaryShortString",
|
||||
value: "\\n"
|
||||
},
|
||||
{
|
||||
name: "Prevent eval",
|
||||
type: "boolean",
|
||||
value: true,
|
||||
description: "Evaluated expressions are disabled by default for security reasons"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -51,7 +45,7 @@ class JPathExpression extends Operation {
|
|||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const [query, delimiter, preventEval] = args;
|
||||
const [query, delimiter] = args;
|
||||
let results, jsonObj;
|
||||
|
||||
try {
|
||||
|
@ -63,8 +57,7 @@ class JPathExpression extends Operation {
|
|||
try {
|
||||
results = JSONPath({
|
||||
path: query,
|
||||
json: jsonObj,
|
||||
preventEval: preventEval
|
||||
json: jsonObj
|
||||
});
|
||||
} catch (err) {
|
||||
throw new OperationError(`Invalid JPath expression: ${err.message}`);
|
||||
|
|
|
@ -8,7 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Normalise Image operation
|
||||
|
@ -43,7 +43,7 @@ class NormaliseImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error opening image file. (${err})`);
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ class NormaliseImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import Utils from "../Utils.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { runHash } from "../lib/Hash.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Randomize Colour Palette operation
|
||||
|
@ -48,7 +48,7 @@ class RandomizeColourPalette extends Operation {
|
|||
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
|
||||
|
||||
const seed = args[0] || (Math.random().toString().substr(2)),
|
||||
parsedImage = await jimp.read(input),
|
||||
parsedImage = await Jimp.read(input),
|
||||
width = parsedImage.bitmap.width,
|
||||
height = parsedImage.bitmap.height;
|
||||
|
||||
|
@ -61,7 +61,7 @@ class RandomizeColourPalette extends Operation {
|
|||
parsedImage.setPixelColor(parseInt(rgbHex, 16), x, y);
|
||||
});
|
||||
|
||||
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO);
|
||||
const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
|
||||
|
||||
return new Uint8Array(imageBuffer).buffer;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Resize Image operation
|
||||
|
@ -80,11 +80,11 @@ class ResizeImage extends Operation {
|
|||
resizeAlg = args[4];
|
||||
|
||||
const resizeMap = {
|
||||
"Nearest Neighbour": jimp.RESIZE_NEAREST_NEIGHBOR,
|
||||
"Bilinear": jimp.RESIZE_BILINEAR,
|
||||
"Bicubic": jimp.RESIZE_BICUBIC,
|
||||
"Hermite": jimp.RESIZE_HERMITE,
|
||||
"Bezier": jimp.RESIZE_BEZIER
|
||||
"Nearest Neighbour": Jimp.RESIZE_NEAREST_NEIGHBOR,
|
||||
"Bilinear": Jimp.RESIZE_BILINEAR,
|
||||
"Bicubic": Jimp.RESIZE_BICUBIC,
|
||||
"Hermite": Jimp.RESIZE_HERMITE,
|
||||
"Bezier": Jimp.RESIZE_BEZIER
|
||||
};
|
||||
|
||||
if (!isImage(input)) {
|
||||
|
@ -93,7 +93,7 @@ class ResizeImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -113,9 +113,9 @@ class ResizeImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Rotate Image operation
|
||||
|
@ -52,7 +52,7 @@ class RotateImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ class RotateImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { isImage } from "../lib/FileType.mjs";
|
|||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import { gaussianBlur } from "../lib/ImageManipulation.mjs";
|
||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Sharpen Image operation
|
||||
|
@ -68,7 +68,7 @@ class SharpenImage extends Operation {
|
|||
|
||||
let image;
|
||||
try {
|
||||
image = await jimp.read(input);
|
||||
image = await Jimp.read(input);
|
||||
} catch (err) {
|
||||
throw new OperationError(`Error loading image. (${err})`);
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ class SharpenImage extends Operation {
|
|||
|
||||
let imageBuffer;
|
||||
if (image.getMIME() === "image/gif") {
|
||||
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
|
||||
} else {
|
||||
imageBuffer = await image.getBufferAsync(jimp.AUTO);
|
||||
imageBuffer = await image.getBufferAsync(Jimp.AUTO);
|
||||
}
|
||||
return imageBuffer.buffer;
|
||||
} catch (err) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Split Colour Channels operation
|
||||
|
@ -41,7 +41,7 @@ class SplitColourChannels extends Operation {
|
|||
// Make sure that the input is an image
|
||||
if (!isImage(input)) throw new OperationError("Invalid file type.");
|
||||
|
||||
const parsedImage = await jimp.read(Buffer.from(input));
|
||||
const parsedImage = await Jimp.read(Buffer.from(input));
|
||||
|
||||
const red = new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
|
@ -51,7 +51,7 @@ class SplitColourChannels extends Operation {
|
|||
{apply: "blue", params: [-255]},
|
||||
{apply: "green", params: [-255]}
|
||||
])
|
||||
.getBufferAsync(jimp.MIME_PNG);
|
||||
.getBufferAsync(Jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError(`Could not split red channel: ${err}`));
|
||||
|
@ -64,7 +64,7 @@ class SplitColourChannels extends Operation {
|
|||
.color([
|
||||
{apply: "red", params: [-255]},
|
||||
{apply: "blue", params: [-255]},
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
]).getBufferAsync(Jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError(`Could not split green channel: ${err}`));
|
||||
|
@ -77,7 +77,7 @@ class SplitColourChannels extends Operation {
|
|||
.color([
|
||||
{apply: "red", params: [-255]},
|
||||
{apply: "green", params: [-255]},
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
]).getBufferAsync(Jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError(`Could not split blue channel: ${err}`));
|
||||
|
|
|
@ -9,7 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
|
|||
import Utils from "../Utils.mjs";
|
||||
import { isImage } from "../lib/FileType.mjs";
|
||||
import { toBase64 } from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* View Bit Plane operation
|
||||
|
@ -52,7 +52,7 @@ class ViewBitPlane extends Operation {
|
|||
if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
|
||||
|
||||
const [colour, bit] = args,
|
||||
parsedImage = await jimp.read(input),
|
||||
parsedImage = await Jimp.read(input),
|
||||
width = parsedImage.bitmap.width,
|
||||
height = parsedImage.bitmap.height,
|
||||
colourIndex = COLOUR_OPTIONS.indexOf(colour),
|
||||
|
@ -78,7 +78,7 @@ class ViewBitPlane extends Operation {
|
|||
|
||||
});
|
||||
|
||||
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO);
|
||||
const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
|
||||
|
||||
return new Uint8Array(imageBuffer).buffer;
|
||||
}
|
||||
|
|
4
src/core/vendor/DisassembleX86-64.mjs
vendored
4
src/core/vendor/DisassembleX86-64.mjs
vendored
|
@ -3199,7 +3199,7 @@ const REG = [
|
|||
REG index 10 Intel MM qword technology MMX vector instructions.
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
These can not be used with Vector length adjustment used in vector extensions. The MM register are the ST registers aliased
|
||||
to MM register. Instructions that use these registers use the the SIMD vector unit registers (MM), these are called the old
|
||||
to MM register. Instructions that use these registers use the SIMD vector unit registers (MM), these are called the old
|
||||
MMX vector instructions. When Intel added the SSE instructions to the SIMD math vector unit the new 128 bit XMM registers,
|
||||
are added into the SIMD unit then they ware made longer in size 256, then 512 across in length, with 1024 (?MM Reserved)
|
||||
In which the vector length setting was added to control there size though vector setting adjustment codes. Instruction
|
||||
|
@ -3784,7 +3784,7 @@ function GotoPosition( Address )
|
|||
/*-------------------------------------------------------------------------------------------------------------------------
|
||||
Finds bit positions to the Size attribute indexes in REG array, and the Pointer Array. For the Size Attribute variations.
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
The SizeAttribute settings is 8 digits big consisting of 1, or 0 to specify the the extended size that an operand can be made.
|
||||
The SizeAttribute settings is 8 digits big consisting of 1, or 0 to specify the extended size that an operand can be made.
|
||||
In which an value of 01100100 is decoded as "0 = 1024, 1 = 512, 1 = 256, 0 = 128, 0 = 64, 1 = 32, 0 = 16, 0 = 8".
|
||||
In which the largest bit position is 512, and is the 6th number "0 = 7, 1 = 6, 1 = 5, 0 = 4, 0 = 3, 1 = 2, 0 = 1, 0 = 0".
|
||||
In which 6 is the bit position for 512 as the returned Size . Each size is in order from 0 to 7, thus the size given back
|
||||
|
|
|
@ -271,7 +271,7 @@ class Manager {
|
|||
* @param {Object} [scope=this] - The object to bind to the callback function
|
||||
*
|
||||
* @example
|
||||
* // Calls the search function whenever the the keyup, paste or search events are triggered on the
|
||||
* // Calls the search function whenever the keyup, paste or search events are triggered on the
|
||||
* // search element
|
||||
* this.addMultiEventListener("search", "keyup paste search", this.search, this);
|
||||
*/
|
||||
|
@ -292,7 +292,7 @@ class Manager {
|
|||
* @param {Object} [scope=this] - The object to bind to the callback function
|
||||
*
|
||||
* @example
|
||||
* // Calls the save function whenever the the keyup or paste events are triggered on any element
|
||||
* // Calls the save function whenever the keyup or paste events are triggered on any element
|
||||
* // with the .saveable class
|
||||
* this.addMultiEventListener(".saveable", "keyup paste", this.save, this);
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue