Updated eslint, Jimp, and other dependencies

This commit is contained in:
n1474335 2024-06-11 18:07:22 +01:00
parent 7eb887ca51
commit 2b275f0897
No known key found for this signature in database
GPG key ID: D15457B7B4AF3F37
35 changed files with 2939 additions and 1926 deletions

View file

@ -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}`));