mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-07 23:11:27 +01:00
Fix remember output folder path (#711)
This commit is contained in:
commit
86e2c76327
@ -2,10 +2,10 @@ import fs from "fs";
|
|||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
import {
|
import {
|
||||||
childProcesses,
|
childProcesses,
|
||||||
customModelsFolderPath,
|
savedCustomModelsPath,
|
||||||
customWidth,
|
customWidth,
|
||||||
noImageProcessing,
|
noImageProcessing,
|
||||||
saveOutputFolder,
|
rememberOutputFolder,
|
||||||
setCompression,
|
setCompression,
|
||||||
setNoImageProcessing,
|
setNoImageProcessing,
|
||||||
setStopped,
|
setStopped,
|
||||||
@ -18,7 +18,6 @@ import { getBatchArguments } from "../utils/get-arguments";
|
|||||||
import slash from "../utils/slash";
|
import slash from "../utils/slash";
|
||||||
import { modelsPath } from "../utils/get-resource-paths";
|
import { modelsPath } from "../utils/get-resource-paths";
|
||||||
import COMMAND from "../../common/commands";
|
import COMMAND from "../../common/commands";
|
||||||
import convertAndScale from "../utils/convert-and-scale";
|
|
||||||
import { BatchUpscaylPayload } from "../../common/types/types";
|
import { BatchUpscaylPayload } from "../../common/types/types";
|
||||||
import { ImageFormat } from "../utils/types";
|
import { ImageFormat } from "../utils/types";
|
||||||
import getModelScale from "../../common/check-model-scale";
|
import getModelScale from "../../common/check-model-scale";
|
||||||
@ -38,7 +37,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
let inputDir = payload.batchFolderPath;
|
let inputDir = payload.batchFolderPath;
|
||||||
// GET THE OUTPUT DIRECTORY
|
// GET THE OUTPUT DIRECTORY
|
||||||
let outputFolderPath = payload.outputPath;
|
let outputFolderPath = payload.outputPath;
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
if (rememberOutputFolder === true && outputFolderPath) {
|
||||||
outputFolderPath = outputFolderPath;
|
outputFolderPath = outputFolderPath;
|
||||||
}
|
}
|
||||||
// ! Don't do fetchLocalStorage() again, it causes the values to be reset
|
// ! Don't do fetchLocalStorage() again, it causes the values to be reset
|
||||||
@ -47,13 +46,9 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
|
|
||||||
const isDefaultModel = DEFAULT_MODELS.includes(model);
|
const isDefaultModel = DEFAULT_MODELS.includes(model);
|
||||||
|
|
||||||
let initialScale = getModelScale(model);
|
const scale = payload.scale;
|
||||||
|
|
||||||
const desiredScale = useCustomWidth
|
const outputFolderName = `upscayl_${saveImageAs}_${model}_${scale}${useCustomWidth ? "px" : "x"}`;
|
||||||
? customWidth || payload.scale
|
|
||||||
: payload.scale;
|
|
||||||
|
|
||||||
const outputFolderName = `upscayl_${saveImageAs}_${model}_${noImageProcessing ? initialScale : desiredScale}${useCustomWidth ? "px" : "x"}`;
|
|
||||||
outputFolderPath += slash + outputFolderName;
|
outputFolderPath += slash + outputFolderName;
|
||||||
if (!fs.existsSync(outputFolderPath)) {
|
if (!fs.existsSync(outputFolderPath)) {
|
||||||
fs.mkdirSync(outputFolderPath, { recursive: true });
|
fs.mkdirSync(outputFolderPath, { recursive: true });
|
||||||
@ -73,15 +68,17 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
|
|
||||||
// UPSCALE
|
// UPSCALE
|
||||||
const upscayl = spawnUpscayl(
|
const upscayl = spawnUpscayl(
|
||||||
getBatchArguments(
|
getBatchArguments({
|
||||||
inputDir,
|
inputDir,
|
||||||
outputFolderPath,
|
outputDir: outputFolderPath,
|
||||||
isDefaultModel ? modelsPath : customModelsFolderPath ?? modelsPath,
|
modelsPath: isDefaultModel
|
||||||
|
? modelsPath
|
||||||
|
: savedCustomModelsPath ?? modelsPath,
|
||||||
model,
|
model,
|
||||||
gpuId,
|
gpuId,
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
initialScale,
|
scale,
|
||||||
),
|
}),
|
||||||
logit,
|
logit,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -98,7 +95,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
COMMAND.FOLDER_UPSCAYL_PROGRESS,
|
COMMAND.FOLDER_UPSCAYL_PROGRESS,
|
||||||
data.toString(),
|
data.toString(),
|
||||||
);
|
);
|
||||||
if (data.includes("invalid") || data.includes("failed")) {
|
if (data.includes("Error") || data.includes("failed")) {
|
||||||
logit("❌ INVALID GPU OR INVALID FILES IN FOLDER - FAILED");
|
logit("❌ INVALID GPU OR INVALID FILES IN FOLDER - FAILED");
|
||||||
failed = true;
|
failed = true;
|
||||||
upscayl.kill();
|
upscayl.kill();
|
||||||
@ -139,47 +136,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const files = fs.readdirSync(inputDir);
|
|
||||||
try {
|
try {
|
||||||
files.forEach(async (file) => {
|
|
||||||
if (file.startsWith(".") || file === outputFolderName) return;
|
|
||||||
console.log("Filename: ", removeFileExtension(file));
|
|
||||||
let upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(
|
|
||||||
file,
|
|
||||||
)}.${saveImageAs}`;
|
|
||||||
let imageIsAlpha = false;
|
|
||||||
if (
|
|
||||||
isAlpha &&
|
|
||||||
saveImageAs === "jpg" &&
|
|
||||||
fs.existsSync(
|
|
||||||
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
imageIsAlpha = true;
|
|
||||||
console.log("This is an Alpha image!");
|
|
||||||
upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`;
|
|
||||||
}
|
|
||||||
await convertAndScale(
|
|
||||||
inputDir + slash + file,
|
|
||||||
upscaledImagePath,
|
|
||||||
`${outputFolderPath}${slash}${removeFileExtension(
|
|
||||||
file,
|
|
||||||
)}.${saveImageAs}`,
|
|
||||||
desiredScale,
|
|
||||||
saveImageAs,
|
|
||||||
imageIsAlpha,
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
isAlpha &&
|
|
||||||
saveImageAs === "jpg" &&
|
|
||||||
fs.existsSync(
|
|
||||||
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
fs.unlinkSync(upscaledImagePath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
COMMAND.FOLDER_UPSCAYL_DONE,
|
COMMAND.FOLDER_UPSCAYL_DONE,
|
||||||
outputFolderPath,
|
outputFolderPath,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { MessageBoxOptions, dialog } from "electron";
|
import { MessageBoxOptions, dialog } from "electron";
|
||||||
import {
|
import {
|
||||||
customModelsFolderPath,
|
savedCustomModelsPath,
|
||||||
setCustomModelsFolderPath,
|
setSavedCustomModelsPath,
|
||||||
} from "../utils/config-variables";
|
} from "../utils/config-variables";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
import slash from "../utils/slash";
|
import slash from "../utils/slash";
|
||||||
@ -22,7 +22,7 @@ const customModelsSelect = async (event, message) => {
|
|||||||
} = await dialog.showOpenDialog({
|
} = await dialog.showOpenDialog({
|
||||||
properties: ["openDirectory"],
|
properties: ["openDirectory"],
|
||||||
title: "Select Custom Models Folder",
|
title: "Select Custom Models Folder",
|
||||||
defaultPath: customModelsFolderPath,
|
defaultPath: savedCustomModelsPath,
|
||||||
securityScopedBookmarks: true,
|
securityScopedBookmarks: true,
|
||||||
message: "Select Custom Models Folder that is named 'models'",
|
message: "Select Custom Models Folder that is named 'models'",
|
||||||
});
|
});
|
||||||
@ -36,7 +36,7 @@ const customModelsSelect = async (event, message) => {
|
|||||||
logit("🚫 Select Custom Models Folder Operation Cancelled");
|
logit("🚫 Select Custom Models Folder Operation Cancelled");
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
setCustomModelsFolderPath(folderPaths[0]);
|
setSavedCustomModelsPath(folderPaths[0]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!folderPaths[0].endsWith(slash + "models") &&
|
!folderPaths[0].endsWith(slash + "models") &&
|
||||||
@ -54,11 +54,11 @@ const customModelsSelect = async (event, message) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const models = await getModels(customModelsFolderPath);
|
const models = await getModels(savedCustomModelsPath);
|
||||||
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
|
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
|
||||||
|
|
||||||
logit("📁 Custom Folder Path: ", customModelsFolderPath);
|
logit("📁 Custom Folder Path: ", savedCustomModelsPath);
|
||||||
return customModelsFolderPath;
|
return savedCustomModelsPath;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@ import path, { parse } from "path";
|
|||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
import {
|
import {
|
||||||
childProcesses,
|
childProcesses,
|
||||||
customModelsFolderPath,
|
savedCustomModelsPath,
|
||||||
customWidth,
|
customWidth,
|
||||||
|
savedBatchUpscaylFolderPath,
|
||||||
noImageProcessing,
|
noImageProcessing,
|
||||||
outputFolderPath,
|
savedOutputPath,
|
||||||
saveOutputFolder,
|
rememberOutputFolder,
|
||||||
setCompression,
|
setCompression,
|
||||||
setNoImageProcessing,
|
setNoImageProcessing,
|
||||||
setStopped,
|
setStopped,
|
||||||
@ -22,7 +23,6 @@ import {
|
|||||||
import { modelsPath } from "../utils/get-resource-paths";
|
import { modelsPath } from "../utils/get-resource-paths";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
import COMMAND from "../../common/commands";
|
import COMMAND from "../../common/commands";
|
||||||
import convertAndScale from "../utils/convert-and-scale";
|
|
||||||
import { DoubleUpscaylPayload } from "../../common/types/types";
|
import { DoubleUpscaylPayload } from "../../common/types/types";
|
||||||
import { ImageFormat } from "../utils/types";
|
import { ImageFormat } from "../utils/types";
|
||||||
import getModelScale from "../../common/check-model-scale";
|
import getModelScale from "../../common/check-model-scale";
|
||||||
@ -39,8 +39,8 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
let inputDir = (imagePath.match(/(.*)[\/\\]/) || [""])[1];
|
let inputDir = (imagePath.match(/(.*)[\/\\]/) || [""])[1];
|
||||||
let outputDir = path.normalize(payload.outputPath);
|
let outputDir = path.normalize(payload.outputPath);
|
||||||
|
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
if (rememberOutputFolder === true && savedOutputPath) {
|
||||||
outputDir = outputFolderPath;
|
outputDir = savedOutputPath;
|
||||||
}
|
}
|
||||||
const gpuId = payload.gpuId as string;
|
const gpuId = payload.gpuId as string;
|
||||||
const saveImageAs = payload.saveImageAs as ImageFormat;
|
const saveImageAs = payload.saveImageAs as ImageFormat;
|
||||||
@ -55,20 +55,14 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
const fullfileName = imagePath.split(slash).slice(-1)[0] as string;
|
const fullfileName = imagePath.split(slash).slice(-1)[0] as string;
|
||||||
const fileName = parse(fullfileName).name;
|
const fileName = parse(fullfileName).name;
|
||||||
|
|
||||||
let initialScale = getModelScale(model);
|
const scale = parseInt(payload.scale) * parseInt(payload.scale);
|
||||||
|
|
||||||
const desiredScale = useCustomWidth
|
|
||||||
? customWidth || parseInt(payload.scale) * parseInt(payload.scale)
|
|
||||||
: parseInt(payload.scale) * parseInt(payload.scale);
|
|
||||||
|
|
||||||
const outFile =
|
const outFile =
|
||||||
outputDir +
|
outputDir +
|
||||||
slash +
|
slash +
|
||||||
fileName +
|
fileName +
|
||||||
"_upscayl_" +
|
"_upscayl_" +
|
||||||
(noImageProcessing
|
scale +
|
||||||
? parseInt(initialScale) * parseInt(initialScale)
|
|
||||||
: desiredScale) +
|
|
||||||
(useCustomWidth ? "px_" : "x_") +
|
(useCustomWidth ? "px_" : "x_") +
|
||||||
model +
|
model +
|
||||||
"." +
|
"." +
|
||||||
@ -76,16 +70,18 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
|
|
||||||
// UPSCALE
|
// UPSCALE
|
||||||
let upscayl = spawnUpscayl(
|
let upscayl = spawnUpscayl(
|
||||||
getDoubleUpscaleArguments(
|
getDoubleUpscaleArguments({
|
||||||
inputDir,
|
inputDir,
|
||||||
fullfileName,
|
fullfileName,
|
||||||
outFile,
|
outFile,
|
||||||
isDefaultModel ? modelsPath : customModelsFolderPath ?? modelsPath,
|
modelsPath: isDefaultModel
|
||||||
|
? modelsPath
|
||||||
|
: savedCustomModelsPath ?? modelsPath,
|
||||||
model,
|
model,
|
||||||
gpuId,
|
gpuId,
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
initialScale,
|
scale: scale.toString(),
|
||||||
),
|
}),
|
||||||
logit,
|
logit,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -103,11 +99,11 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
// SEND UPSCAYL PROGRESS TO RENDERER
|
// SEND UPSCAYL PROGRESS TO RENDERER
|
||||||
mainWindow.webContents.send(COMMAND.DOUBLE_UPSCAYL_PROGRESS, data);
|
mainWindow.webContents.send(COMMAND.DOUBLE_UPSCAYL_PROGRESS, data);
|
||||||
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
|
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
|
||||||
if (data.includes("invalid gpu") || data.includes("failed")) {
|
if (data.includes("Error") || data.includes("failed")) {
|
||||||
upscayl.kill();
|
upscayl.kill();
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
if (data.includes("has alpha channel")) {
|
if (data.includes("alpha channel")) {
|
||||||
isAlpha = true;
|
isAlpha = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -141,12 +137,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
mainWindow.setProgressBar(-1);
|
mainWindow.setProgressBar(-1);
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
COMMAND.DOUBLE_UPSCAYL_DONE,
|
COMMAND.DOUBLE_UPSCAYL_DONE,
|
||||||
isAlpha
|
outFile.replace(
|
||||||
? (outFile + ".png").replace(
|
|
||||||
/([^/\\]+)$/i,
|
|
||||||
encodeURIComponent((outFile + ".png").match(/[^/\\]+$/i)![0]),
|
|
||||||
)
|
|
||||||
: outFile.replace(
|
|
||||||
/([^/\\]+)$/i,
|
/([^/\\]+)$/i,
|
||||||
encodeURIComponent(outFile.match(/[^/\\]+$/i)![0]),
|
encodeURIComponent(outFile.match(/[^/\\]+$/i)![0]),
|
||||||
),
|
),
|
||||||
@ -155,14 +146,6 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await convertAndScale(
|
|
||||||
inputDir + slash + fullfileName,
|
|
||||||
isAlpha ? outFile + ".png" : outFile,
|
|
||||||
outFile,
|
|
||||||
desiredScale.toString(),
|
|
||||||
saveImageAs,
|
|
||||||
isAlpha,
|
|
||||||
);
|
|
||||||
mainWindow.setProgressBar(-1);
|
mainWindow.setProgressBar(-1);
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
COMMAND.DOUBLE_UPSCAYL_DONE,
|
COMMAND.DOUBLE_UPSCAYL_DONE,
|
||||||
@ -171,9 +154,6 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
encodeURIComponent(outFile.match(/[^/\\]+$/i)![0]),
|
encodeURIComponent(outFile.match(/[^/\\]+$/i)![0]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (isAlpha && saveImageAs === "jpg") {
|
|
||||||
unlinkSync(outFile + ".png");
|
|
||||||
}
|
|
||||||
showNotification("Upscayled", "Image upscayled successfully!");
|
showNotification("Upscayled", "Image upscayled successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logit("❌ Error reading original image metadata", error);
|
logit("❌ Error reading original image metadata", error);
|
||||||
@ -196,15 +176,17 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
|||||||
if (!failed && !stopped) {
|
if (!failed && !stopped) {
|
||||||
// UPSCALE
|
// UPSCALE
|
||||||
let upscayl2 = spawnUpscayl(
|
let upscayl2 = spawnUpscayl(
|
||||||
getDoubleUpscaleSecondPassArguments(
|
getDoubleUpscaleSecondPassArguments({
|
||||||
isAlpha,
|
isAlpha,
|
||||||
outFile,
|
outFile,
|
||||||
isDefaultModel ? modelsPath : customModelsFolderPath ?? modelsPath,
|
modelsPath: isDefaultModel
|
||||||
|
? modelsPath
|
||||||
|
: savedCustomModelsPath ?? modelsPath,
|
||||||
model,
|
model,
|
||||||
gpuId,
|
gpuId,
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
initialScale,
|
scale: scale.toString(),
|
||||||
),
|
}),
|
||||||
logit,
|
logit,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import COMMAND from "../../common/commands";
|
import COMMAND from "../../common/commands";
|
||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
import {
|
import {
|
||||||
customModelsFolderPath,
|
savedCustomModelsPath,
|
||||||
setCustomModelsFolderPath,
|
setSavedCustomModelsPath,
|
||||||
} from "../utils/config-variables";
|
} from "../utils/config-variables";
|
||||||
import getModels from "../utils/get-models";
|
import getModels from "../utils/get-models";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
@ -12,9 +12,9 @@ const getModelsList = async (event, payload) => {
|
|||||||
|
|
||||||
if (!mainWindow) return;
|
if (!mainWindow) return;
|
||||||
if (payload) {
|
if (payload) {
|
||||||
setCustomModelsFolderPath(payload);
|
setSavedCustomModelsPath(payload);
|
||||||
|
|
||||||
logit("📁 Custom Models Folder Path: ", customModelsFolderPath);
|
logit("📁 Custom Models Folder Path: ", savedCustomModelsPath);
|
||||||
const models = await getModels(payload);
|
const models = await getModels(payload);
|
||||||
|
|
||||||
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
|
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
|
||||||
|
@ -2,13 +2,13 @@ import fs from "fs";
|
|||||||
import { modelsPath } from "../utils/get-resource-paths";
|
import { modelsPath } from "../utils/get-resource-paths";
|
||||||
import COMMAND from "../../common/commands";
|
import COMMAND from "../../common/commands";
|
||||||
import {
|
import {
|
||||||
compression,
|
savedCompression,
|
||||||
customModelsFolderPath,
|
savedCustomModelsPath,
|
||||||
customWidth,
|
customWidth,
|
||||||
folderPath,
|
savedBatchUpscaylFolderPath,
|
||||||
noImageProcessing,
|
noImageProcessing,
|
||||||
outputFolderPath,
|
savedOutputPath,
|
||||||
saveOutputFolder,
|
rememberOutputFolder,
|
||||||
setChildProcesses,
|
setChildProcesses,
|
||||||
setCompression,
|
setCompression,
|
||||||
setNoImageProcessing,
|
setNoImageProcessing,
|
||||||
@ -16,7 +16,6 @@ import {
|
|||||||
stopped,
|
stopped,
|
||||||
useCustomWidth,
|
useCustomWidth,
|
||||||
} from "../utils/config-variables";
|
} from "../utils/config-variables";
|
||||||
import convertAndScale from "../utils/convert-and-scale";
|
|
||||||
import { getSingleImageArguments } from "../utils/get-arguments";
|
import { getSingleImageArguments } from "../utils/get-arguments";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
import slash from "../utils/slash";
|
import slash from "../utils/slash";
|
||||||
@ -26,7 +25,6 @@ import { getMainWindow } from "../main-window";
|
|||||||
import { ImageUpscaylPayload } from "../../common/types/types";
|
import { ImageUpscaylPayload } from "../../common/types/types";
|
||||||
import { ImageFormat } from "../utils/types";
|
import { ImageFormat } from "../utils/types";
|
||||||
import getModelScale from "../../common/check-model-scale";
|
import getModelScale from "../../common/check-model-scale";
|
||||||
import removeFileExtension from "../utils/remove-file-extension";
|
|
||||||
import showNotification from "../utils/show-notification";
|
import showNotification from "../utils/show-notification";
|
||||||
import { DEFAULT_MODELS } from "../../common/models-list";
|
import { DEFAULT_MODELS } from "../../common/models-list";
|
||||||
|
|
||||||
@ -41,29 +39,27 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
|||||||
setNoImageProcessing(payload.noImageProcessing);
|
setNoImageProcessing(payload.noImageProcessing);
|
||||||
setCompression(parseInt(payload.compression));
|
setCompression(parseInt(payload.compression));
|
||||||
|
|
||||||
|
// GET VARIABLES
|
||||||
const model = payload.model as string;
|
const model = payload.model as string;
|
||||||
const gpuId = payload.gpuId as string;
|
const gpuId = payload.gpuId as string;
|
||||||
const saveImageAs = payload.saveImageAs as ImageFormat;
|
const saveImageAs = payload.saveImageAs as ImageFormat;
|
||||||
console.log("🚀 => saveImageAs:", saveImageAs);
|
|
||||||
|
|
||||||
const overwrite = payload.overwrite as boolean;
|
const overwrite = payload.overwrite as boolean;
|
||||||
|
|
||||||
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)?.[1] || "") as string;
|
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)?.[1] || "") as string;
|
||||||
let outputDir: string | undefined =
|
let outputDir: string | undefined =
|
||||||
folderPath || (payload.outputPath as string);
|
savedBatchUpscaylFolderPath || (payload.outputPath as string);
|
||||||
|
if (
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
rememberOutputFolder === true &&
|
||||||
outputDir = outputFolderPath;
|
savedOutputPath &&
|
||||||
|
savedOutputPath?.length > 0
|
||||||
|
) {
|
||||||
|
logit("🧠 Using saved output path");
|
||||||
|
outputDir = savedOutputPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDefaultModel = DEFAULT_MODELS.includes(model);
|
const isDefaultModel = DEFAULT_MODELS.includes(model);
|
||||||
logit("Is Default Model? : ", isDefaultModel);
|
logit("Is Default Model? : ", isDefaultModel);
|
||||||
const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, "") as string;
|
const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, "") as string;
|
||||||
const fileName = parse(fullfileName).name;
|
const fileName = parse(fullfileName).name;
|
||||||
const fileExt = parse(fullfileName).ext;
|
const fileExt = parse(fullfileName).ext;
|
||||||
|
|
||||||
let initialScale = getModelScale(model);
|
|
||||||
|
|
||||||
const desiredScale = useCustomWidth
|
const desiredScale = useCustomWidth
|
||||||
? customWidth || payload.scale
|
? customWidth || payload.scale
|
||||||
: payload.scale;
|
: payload.scale;
|
||||||
@ -73,7 +69,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
|||||||
slash +
|
slash +
|
||||||
fileName +
|
fileName +
|
||||||
"_upscayl_" +
|
"_upscayl_" +
|
||||||
(noImageProcessing ? initialScale : desiredScale) +
|
desiredScale +
|
||||||
(useCustomWidth ? "px_" : "x_") +
|
(useCustomWidth ? "px_" : "x_") +
|
||||||
model +
|
model +
|
||||||
"." +
|
"." +
|
||||||
@ -101,23 +97,25 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
|||||||
outputDir,
|
outputDir,
|
||||||
fullfileName,
|
fullfileName,
|
||||||
fileName,
|
fileName,
|
||||||
initialScale: initialScale,
|
scale: desiredScale,
|
||||||
desiredScale,
|
desiredScale,
|
||||||
outFile,
|
outFile,
|
||||||
compression,
|
compression: savedCompression,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const upscayl = spawnUpscayl(
|
const upscayl = spawnUpscayl(
|
||||||
getSingleImageArguments(
|
getSingleImageArguments({
|
||||||
inputDir,
|
inputDir,
|
||||||
fullfileName,
|
fullfileName,
|
||||||
outFile,
|
outFile,
|
||||||
isDefaultModel ? modelsPath : customModelsFolderPath ?? modelsPath,
|
modelsPath: isDefaultModel
|
||||||
|
? modelsPath
|
||||||
|
: savedCustomModelsPath ?? modelsPath,
|
||||||
model,
|
model,
|
||||||
initialScale,
|
scale: desiredScale,
|
||||||
gpuId,
|
gpuId,
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
),
|
}),
|
||||||
logit,
|
logit,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -170,17 +168,6 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
|
|||||||
// Free up memory
|
// Free up memory
|
||||||
upscayl.kill();
|
upscayl.kill();
|
||||||
try {
|
try {
|
||||||
await convertAndScale(
|
|
||||||
inputDir + slash + fullfileName,
|
|
||||||
isAlpha ? outFile + ".png" : outFile,
|
|
||||||
outFile,
|
|
||||||
desiredScale,
|
|
||||||
saveImageAs,
|
|
||||||
isAlpha,
|
|
||||||
);
|
|
||||||
if (isAlpha && saveImageAs === "jpg") {
|
|
||||||
fs.unlinkSync(outFile + ".png");
|
|
||||||
}
|
|
||||||
mainWindow.setProgressBar(-1);
|
mainWindow.setProgressBar(-1);
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
COMMAND.UPSCAYL_DONE,
|
COMMAND.UPSCAYL_DONE,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { MessageBoxOptions, app, dialog } from "electron";
|
import { MessageBoxOptions, app, dialog } from "electron";
|
||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
import { imagePath, setImagePath } from "../utils/config-variables";
|
import { savedImagePath, setSavedImagePath } from "../utils/config-variables";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
import settings from "electron-settings";
|
import settings from "electron-settings";
|
||||||
import { featureFlags } from "../../common/feature-flags";
|
import { featureFlags } from "../../common/feature-flags";
|
||||||
@ -11,7 +11,7 @@ const selectFile = async () => {
|
|||||||
const { canceled, filePaths, bookmarks } = await dialog.showOpenDialog({
|
const { canceled, filePaths, bookmarks } = await dialog.showOpenDialog({
|
||||||
properties: ["openFile"],
|
properties: ["openFile"],
|
||||||
title: "Select Image",
|
title: "Select Image",
|
||||||
defaultPath: imagePath,
|
defaultPath: savedImagePath,
|
||||||
securityScopedBookmarks: true,
|
securityScopedBookmarks: true,
|
||||||
message: "Select Image to Upscale",
|
message: "Select Image to Upscale",
|
||||||
filters: [
|
filters: [
|
||||||
@ -40,7 +40,7 @@ const selectFile = async () => {
|
|||||||
logit("🚫 File Operation Cancelled");
|
logit("🚫 File Operation Cancelled");
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
setImagePath(filePaths[0]);
|
setSavedImagePath(filePaths[0]);
|
||||||
|
|
||||||
let isValid = false;
|
let isValid = false;
|
||||||
// READ SELECTED FILES
|
// READ SELECTED FILES
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { app, dialog } from "electron";
|
import { app, dialog } from "electron";
|
||||||
import { folderPath, setFolderPath } from "../utils/config-variables";
|
import {
|
||||||
|
savedBatchUpscaylFolderPath,
|
||||||
|
setSavedBatchUpscaylFolderPath,
|
||||||
|
} from "../utils/config-variables";
|
||||||
import logit from "../utils/logit";
|
import logit from "../utils/logit";
|
||||||
import settings from "electron-settings";
|
import settings from "electron-settings";
|
||||||
import { featureFlags } from "../../common/feature-flags";
|
import { featureFlags } from "../../common/feature-flags";
|
||||||
@ -11,7 +14,7 @@ const selectFolder = async (event, message) => {
|
|||||||
logit("🚨 Folder Bookmarks: ", folderBookmarks);
|
logit("🚨 Folder Bookmarks: ", folderBookmarks);
|
||||||
try {
|
try {
|
||||||
closeAccess = app.startAccessingSecurityScopedResource(
|
closeAccess = app.startAccessingSecurityScopedResource(
|
||||||
folderBookmarks as string
|
folderBookmarks as string,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logit("📁 Folder Bookmarks Error: ", error);
|
logit("📁 Folder Bookmarks Error: ", error);
|
||||||
@ -24,7 +27,7 @@ const selectFolder = async (event, message) => {
|
|||||||
bookmarks,
|
bookmarks,
|
||||||
} = await dialog.showOpenDialog({
|
} = await dialog.showOpenDialog({
|
||||||
properties: ["openDirectory"],
|
properties: ["openDirectory"],
|
||||||
defaultPath: folderPath,
|
defaultPath: savedBatchUpscaylFolderPath,
|
||||||
securityScopedBookmarks: true,
|
securityScopedBookmarks: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -37,8 +40,8 @@ const selectFolder = async (event, message) => {
|
|||||||
logit("🚫 Select Folder Operation Cancelled");
|
logit("🚫 Select Folder Operation Cancelled");
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
setFolderPath(folderPaths[0]);
|
setSavedBatchUpscaylFolderPath(folderPaths[0]);
|
||||||
logit("📁 Selected Folder Path: ", folderPath);
|
logit("📁 Selected Folder Path: ", savedBatchUpscaylFolderPath);
|
||||||
return folderPaths[0];
|
return folderPaths[0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -17,13 +17,11 @@ import { execPath, modelsPath } from "./utils/get-resource-paths";
|
|||||||
import batchUpscayl from "./commands/batch-upscayl";
|
import batchUpscayl from "./commands/batch-upscayl";
|
||||||
import doubleUpscayl from "./commands/double-upscayl";
|
import doubleUpscayl from "./commands/double-upscayl";
|
||||||
import autoUpdate from "./commands/auto-update";
|
import autoUpdate from "./commands/auto-update";
|
||||||
import sharp from "sharp";
|
|
||||||
import { featureFlags } from "../common/feature-flags";
|
import { featureFlags } from "../common/feature-flags";
|
||||||
import settings from "electron-settings";
|
import settings from "electron-settings";
|
||||||
|
|
||||||
// INITIALIZATION
|
// INITIALIZATION
|
||||||
log.initialize({ preload: true });
|
log.initialize({ preload: true });
|
||||||
sharp.cache(false);
|
|
||||||
logit("🚃 App Path: ", app.getAppPath());
|
logit("🚃 App Path: ", app.getAppPath());
|
||||||
|
|
||||||
app.on("ready", async () => {
|
app.on("ready", async () => {
|
||||||
@ -51,7 +49,7 @@ app.on("ready", async () => {
|
|||||||
logit("🚨 Folder Bookmarks: ", folderBookmarks);
|
logit("🚨 Folder Bookmarks: ", folderBookmarks);
|
||||||
try {
|
try {
|
||||||
closeAccess = app.startAccessingSecurityScopedResource(
|
closeAccess = app.startAccessingSecurityScopedResource(
|
||||||
folderBookmarks as string
|
folderBookmarks as string,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logit("📁 Folder Bookmarks Error: ", error);
|
logit("📁 Folder Bookmarks Error: ", error);
|
||||||
|
@ -2,52 +2,81 @@ import { ChildProcessWithoutNullStreams } from "child_process";
|
|||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
import logit from "./logit";
|
import logit from "./logit";
|
||||||
|
|
||||||
export let imagePath: string | undefined = "";
|
/**
|
||||||
export let folderPath: string | undefined = undefined;
|
* The saved image path so that the select image dialog can open to the last used path.
|
||||||
export let customModelsFolderPath: string | undefined = undefined;
|
*/
|
||||||
export let outputFolderPath: string | undefined = undefined;
|
export let savedImagePath: string | undefined = "";
|
||||||
export let saveOutputFolder = false;
|
export function setSavedImagePath(value: string | undefined): void {
|
||||||
export let compression = 0;
|
savedImagePath = value;
|
||||||
|
logit("🖼️ Updating Image Path: ", savedImagePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The saved folder path so that the select folder to upscayl dialog can open to the last used path.
|
||||||
|
*/
|
||||||
|
export let savedBatchUpscaylFolderPath: string | undefined = undefined;
|
||||||
|
export function setSavedBatchUpscaylFolderPath(
|
||||||
|
value: string | undefined,
|
||||||
|
): void {
|
||||||
|
savedBatchUpscaylFolderPath = value;
|
||||||
|
logit("📁 Updating Folder Path: ", savedBatchUpscaylFolderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
export let savedCustomModelsPath: string | undefined = undefined;
|
||||||
|
export function setSavedCustomModelsPath(value: string | undefined): void {
|
||||||
|
savedCustomModelsPath = value;
|
||||||
|
logit("📁 Updating Custom Models Folder Path: ", savedCustomModelsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
export let savedOutputPath: string | undefined = undefined;
|
||||||
|
export function setSavedOutputPath(value: string | undefined): void {
|
||||||
|
savedOutputPath = value;
|
||||||
|
logit("📁 Updating Output Folder Path: ", savedOutputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
export let rememberOutputFolder = false;
|
||||||
|
export function setRememberOutputFolder(value: boolean): void {
|
||||||
|
rememberOutputFolder = value;
|
||||||
|
logit("💾 Updating Remember Output Folder: ", rememberOutputFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
export let savedCompression = 0;
|
||||||
|
export function setCompression(value: number): void {
|
||||||
|
savedCompression = value;
|
||||||
|
logit("📐 Updating Compression: ", savedCompression);
|
||||||
|
}
|
||||||
|
|
||||||
export let stopped = false;
|
export let stopped = false;
|
||||||
export let childProcesses: {
|
export let childProcesses: {
|
||||||
process: ChildProcessWithoutNullStreams;
|
process: ChildProcessWithoutNullStreams;
|
||||||
kill: () => boolean;
|
kill: () => boolean;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
export let noImageProcessing: boolean = false;
|
export let noImageProcessing: boolean = false;
|
||||||
|
export function setNoImageProcessing(value: boolean): void {
|
||||||
|
noImageProcessing = value;
|
||||||
|
logit("🖼️ Updating No Image Processing: ", noImageProcessing);
|
||||||
|
}
|
||||||
|
|
||||||
export let turnOffNotifications: boolean = false;
|
export let turnOffNotifications: boolean = false;
|
||||||
|
export function setTurnOffNotifications(value: boolean): void {
|
||||||
|
turnOffNotifications = value;
|
||||||
|
logit("🔕 Updating Turn Off Notifications: ", turnOffNotifications);
|
||||||
|
}
|
||||||
|
|
||||||
export let customWidth: string | null = null;
|
export let customWidth: string | null = null;
|
||||||
|
export function setCustomWidth(value: string | null): void {
|
||||||
|
customWidth = value;
|
||||||
|
logit("📏 Updating Custom Width: ", customWidth);
|
||||||
|
}
|
||||||
|
|
||||||
export let useCustomWidth: boolean = false;
|
export let useCustomWidth: boolean = false;
|
||||||
|
export function setUseCustomWidth(value: boolean): void {
|
||||||
export function setImagePath(value: string | undefined): void {
|
useCustomWidth = value;
|
||||||
imagePath = value;
|
logit("📏 Updating Use Custom Width: ", useCustomWidth);
|
||||||
logit("🖼️ Updating Image Path: ", imagePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setFolderPath(value: string | undefined): void {
|
|
||||||
folderPath = value;
|
|
||||||
logit("📁 Updating Folder Path: ", folderPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setCustomModelsFolderPath(value: string | undefined): void {
|
|
||||||
customModelsFolderPath = value;
|
|
||||||
logit("📁 Updating Custom Models Folder Path: ", customModelsFolderPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SETTERS
|
// SETTERS
|
||||||
export function setOutputFolderPath(value: string | undefined): void {
|
|
||||||
outputFolderPath = value;
|
|
||||||
logit("📁 Updating Output Folder Path: ", outputFolderPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setSaveOutputFolder(value: boolean): void {
|
|
||||||
saveOutputFolder = value;
|
|
||||||
logit("💾 Updating Save Output Folder: ", saveOutputFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setCompression(value: number): void {
|
|
||||||
compression = value;
|
|
||||||
logit("📐 Updating Compression: ", compression);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setStopped(value: boolean): void {
|
export function setStopped(value: boolean): void {
|
||||||
stopped = value;
|
stopped = value;
|
||||||
@ -68,26 +97,6 @@ export function setChildProcesses(value: {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setNoImageProcessing(value: boolean): void {
|
|
||||||
noImageProcessing = value;
|
|
||||||
logit("🖼️ Updating No Image Processing: ", noImageProcessing);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setTurnOffNotifications(value: boolean): void {
|
|
||||||
turnOffNotifications = value;
|
|
||||||
logit("🔕 Updating Turn Off Notifications: ", turnOffNotifications);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setCustomWidth(value: string | null): void {
|
|
||||||
customWidth = value;
|
|
||||||
logit("📏 Updating Custom Width: ", customWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setUseCustomWidth(value: boolean): void {
|
|
||||||
useCustomWidth = value;
|
|
||||||
logit("📏 Updating Use Custom Width: ", useCustomWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LOCAL STORAGE
|
// LOCAL STORAGE
|
||||||
export function fetchLocalStorage(): void {
|
export function fetchLocalStorage(): void {
|
||||||
const mainWindow = getMainWindow();
|
const mainWindow = getMainWindow();
|
||||||
@ -98,34 +107,37 @@ export function fetchLocalStorage(): void {
|
|||||||
.executeJavaScript('localStorage.getItem("lastImagePath");', true)
|
.executeJavaScript('localStorage.getItem("lastImagePath");', true)
|
||||||
.then((lastImagePath: string | null) => {
|
.then((lastImagePath: string | null) => {
|
||||||
if (lastImagePath && lastImagePath.length > 0) {
|
if (lastImagePath && lastImagePath.length > 0) {
|
||||||
setImagePath(lastImagePath);
|
setSavedImagePath(lastImagePath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// GET LAST FOLDER PATH TO LOCAL STORAGE
|
// GET LAST FOLDER PATH TO LOCAL STORAGE
|
||||||
mainWindow.webContents
|
|
||||||
.executeJavaScript('localStorage.getItem("lastFolderPath");', true)
|
|
||||||
.then((lastFolderPath: string | null) => {
|
|
||||||
if (lastFolderPath && lastFolderPath.length > 0) {
|
|
||||||
setFolderPath(lastFolderPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// GET LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
|
||||||
mainWindow.webContents
|
mainWindow.webContents
|
||||||
.executeJavaScript(
|
.executeJavaScript(
|
||||||
'localStorage.getItem("lastCustomModelsFolderPath");',
|
'localStorage.getItem("lastSavedBatchUpscaylFolderPath");',
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
.then((lastCustomModelsFolderPath: string | null) => {
|
.then((lastSavedBatchUpscaylFolderPath: string | null) => {
|
||||||
if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) {
|
if (
|
||||||
setCustomModelsFolderPath(lastCustomModelsFolderPath);
|
lastSavedBatchUpscaylFolderPath &&
|
||||||
|
lastSavedBatchUpscaylFolderPath.length > 0
|
||||||
|
) {
|
||||||
|
setSavedBatchUpscaylFolderPath(lastSavedBatchUpscaylFolderPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// GET LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
// GET LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
||||||
mainWindow.webContents
|
mainWindow.webContents
|
||||||
.executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true)
|
.executeJavaScript('localStorage.getItem("customModelsFolderPath");', true)
|
||||||
.then((lastOutputFolderPath: string | null) => {
|
.then((value: string | null) => {
|
||||||
if (lastOutputFolderPath && lastOutputFolderPath.length > 0) {
|
if (value && value.length > 0) {
|
||||||
setOutputFolderPath(lastOutputFolderPath);
|
setSavedCustomModelsPath(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// GET LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
||||||
|
mainWindow.webContents
|
||||||
|
.executeJavaScript('localStorage.getItem("savedOutputPath");', true)
|
||||||
|
.then((savedOutputPath: string | null) => {
|
||||||
|
if (savedOutputPath && savedOutputPath.length > 0) {
|
||||||
|
setSavedOutputPath(savedOutputPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// GET LAST SAVE OUTPUT FOLDER (BOOLEAN) TO LOCAL STORAGE
|
// GET LAST SAVE OUTPUT FOLDER (BOOLEAN) TO LOCAL STORAGE
|
||||||
@ -133,7 +145,7 @@ export function fetchLocalStorage(): void {
|
|||||||
.executeJavaScript('localStorage.getItem("rememberOutputFolder");', true)
|
.executeJavaScript('localStorage.getItem("rememberOutputFolder");', true)
|
||||||
.then((lastSaveOutputFolder: boolean | null) => {
|
.then((lastSaveOutputFolder: boolean | null) => {
|
||||||
if (lastSaveOutputFolder !== null) {
|
if (lastSaveOutputFolder !== null) {
|
||||||
setSaveOutputFolder(lastSaveOutputFolder);
|
setRememberOutputFolder(lastSaveOutputFolder);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// GET IMAGE COMPRESSION (NUMBER) FROM LOCAL STORAGE
|
// GET IMAGE COMPRESSION (NUMBER) FROM LOCAL STORAGE
|
||||||
|
@ -1,137 +0,0 @@
|
|||||||
import fs from "fs";
|
|
||||||
import sharp, { FormatEnum, Metadata } from "sharp";
|
|
||||||
import logit from "./logit";
|
|
||||||
import { compression, customWidth } from "./config-variables";
|
|
||||||
import { ImageFormat } from "./types";
|
|
||||||
|
|
||||||
const convertAndScale = async (
|
|
||||||
originalImagePath: string,
|
|
||||||
upscaledImagePath: string,
|
|
||||||
processedImagePath: string,
|
|
||||||
scale: string,
|
|
||||||
saveImageAs: ImageFormat,
|
|
||||||
imageIsAlpha?: boolean,
|
|
||||||
) => {
|
|
||||||
// Skip conversion when the scale is 4x and compression is 0
|
|
||||||
// - When output format is WebP or PNG
|
|
||||||
// - When the image is not alpha and the output format is JPEG
|
|
||||||
if (
|
|
||||||
!customWidth &&
|
|
||||||
(saveImageAs === "png" || saveImageAs === "webp") &&
|
|
||||||
scale === "4" &&
|
|
||||||
compression === 0
|
|
||||||
) {
|
|
||||||
logit("Skipping compression for 4x scale and 0% compression");
|
|
||||||
return;
|
|
||||||
} else if (
|
|
||||||
!customWidth &&
|
|
||||||
saveImageAs === "jpg" &&
|
|
||||||
scale === "4" &&
|
|
||||||
compression === 0 &&
|
|
||||||
!imageIsAlpha
|
|
||||||
) {
|
|
||||||
logit("Skipping compression for 4x scale and 0% compression");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let originalImage: Metadata | undefined;
|
|
||||||
|
|
||||||
try {
|
|
||||||
originalImage = await sharp(originalImagePath).metadata();
|
|
||||||
} catch (error) {
|
|
||||||
logit("❌ Error with original Image: ", error, " - ", originalImagePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.access(originalImagePath, fs.constants.F_OK, (err) => {
|
|
||||||
logit("🖼️ Checking if original image exists: ", originalImagePath);
|
|
||||||
if (err) {
|
|
||||||
throw new Error(
|
|
||||||
"Could not grab the original image from the path provided! - " + err,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!originalImage) {
|
|
||||||
throw new Error("Could not grab the original image!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert compression percentage (0-100) to compressionLevel (0-9)
|
|
||||||
const compressionLevel = Math.round((compression / 100) * 9);
|
|
||||||
|
|
||||||
logit(
|
|
||||||
"📐 Processing Image: ",
|
|
||||||
JSON.stringify({
|
|
||||||
originalWidth: originalImage.width,
|
|
||||||
originalHeight: originalImage.height,
|
|
||||||
customWidth,
|
|
||||||
scale,
|
|
||||||
saveImageAs,
|
|
||||||
compressionPercentage: compression,
|
|
||||||
compressionLevel,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Resize the image to the scale
|
|
||||||
const newImage = sharp(upscaledImagePath, {
|
|
||||||
limitInputPixels: false,
|
|
||||||
})
|
|
||||||
.resize(
|
|
||||||
customWidth
|
|
||||||
? parseInt(customWidth)
|
|
||||||
: originalImage.width && originalImage.width * parseInt(scale),
|
|
||||||
customWidth
|
|
||||||
? null
|
|
||||||
: originalImage.height && originalImage.height * parseInt(scale),
|
|
||||||
)
|
|
||||||
.withMetadata({
|
|
||||||
density: originalImage.density,
|
|
||||||
orientation: originalImage.orientation,
|
|
||||||
});
|
|
||||||
|
|
||||||
const buffer = await newImage
|
|
||||||
.withMetadata({
|
|
||||||
density: originalImage.density,
|
|
||||||
orientation: originalImage.orientation,
|
|
||||||
})
|
|
||||||
.toBuffer();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await sharp(buffer, {
|
|
||||||
limitInputPixels: false,
|
|
||||||
})
|
|
||||||
.withMetadata({
|
|
||||||
density: originalImage.density,
|
|
||||||
orientation: originalImage.orientation,
|
|
||||||
})
|
|
||||||
.toFormat(saveImageAs as keyof FormatEnum, {
|
|
||||||
...(saveImageAs === "jpg" && {
|
|
||||||
quality: 100 - (compression === 100 ? 99 : compression),
|
|
||||||
chromaSubsampling: "4:4:4",
|
|
||||||
}),
|
|
||||||
// For PNGs, compression enables indexed colors automatically,
|
|
||||||
// so we need to warn the user that this will happen
|
|
||||||
// https://sharp.pixelplumbing.com/api-output#png
|
|
||||||
...(saveImageAs === "png" &&
|
|
||||||
compression > 0 && {
|
|
||||||
...(compression > 0 && {
|
|
||||||
quality: 100 - (compression === 100 ? 99 : compression),
|
|
||||||
}),
|
|
||||||
compressionLevel: 9,
|
|
||||||
}),
|
|
||||||
...(saveImageAs === "webp" && {
|
|
||||||
quality: 100 - (compression === 100 ? 99 : compression),
|
|
||||||
alphaQuality: 100,
|
|
||||||
lossless: compression === 0,
|
|
||||||
smartSubsample: true,
|
|
||||||
}),
|
|
||||||
force: true,
|
|
||||||
})
|
|
||||||
.toFile(processedImagePath);
|
|
||||||
} catch (error) {
|
|
||||||
logit("❌ Error converting to: ", saveImageAs, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
logit("✅ Done converting to: ", upscaledImagePath);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default convertAndScale;
|
|
@ -2,16 +2,25 @@ import { getPlatform } from "./get-device-specs";
|
|||||||
import { ImageFormat } from "./types";
|
import { ImageFormat } from "./types";
|
||||||
const slash: string = getPlatform() === "win" ? "\\" : "/";
|
const slash: string = getPlatform() === "win" ? "\\" : "/";
|
||||||
|
|
||||||
export const getSingleImageArguments = (
|
export const getSingleImageArguments = ({
|
||||||
inputDir: string,
|
inputDir,
|
||||||
fullfileName: string,
|
fullfileName,
|
||||||
outFile: string,
|
outFile,
|
||||||
modelsPath: string,
|
modelsPath,
|
||||||
model: string,
|
model,
|
||||||
scale: any,
|
scale,
|
||||||
gpuId: string,
|
gpuId,
|
||||||
saveImageAs: ImageFormat,
|
saveImageAs,
|
||||||
) => {
|
}: {
|
||||||
|
inputDir: string;
|
||||||
|
fullfileName: string;
|
||||||
|
outFile: string;
|
||||||
|
modelsPath: string;
|
||||||
|
model: string;
|
||||||
|
scale: any;
|
||||||
|
gpuId: string;
|
||||||
|
saveImageAs: ImageFormat;
|
||||||
|
}) => {
|
||||||
return [
|
return [
|
||||||
"-i",
|
"-i",
|
||||||
inputDir + slash + fullfileName,
|
inputDir + slash + fullfileName,
|
||||||
@ -30,43 +39,25 @@ export const getSingleImageArguments = (
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSingleImageSharpenArguments = (
|
export const getDoubleUpscaleArguments = ({
|
||||||
inputDir: string,
|
inputDir,
|
||||||
fullfileName: string,
|
fullfileName,
|
||||||
outFile: string,
|
|
||||||
modelsPath: string,
|
|
||||||
model: string,
|
|
||||||
scale: any,
|
|
||||||
gpuId: string,
|
|
||||||
saveImageAs: ImageFormat,
|
|
||||||
) => {
|
|
||||||
return [
|
|
||||||
"-i",
|
|
||||||
inputDir + slash + fullfileName,
|
|
||||||
"-o",
|
|
||||||
outFile,
|
outFile,
|
||||||
"-s",
|
modelsPath,
|
||||||
scale,
|
model,
|
||||||
"-x",
|
gpuId,
|
||||||
"-m",
|
|
||||||
modelsPath + slash + model,
|
|
||||||
gpuId ? "-g" : "",
|
|
||||||
gpuId ? gpuId : "",
|
|
||||||
"-f",
|
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
];
|
scale,
|
||||||
};
|
}: {
|
||||||
|
inputDir: string;
|
||||||
export const getDoubleUpscaleArguments = (
|
fullfileName: string;
|
||||||
inputDir: string,
|
outFile: string;
|
||||||
fullfileName: string,
|
modelsPath: string;
|
||||||
outFile: string,
|
model: string;
|
||||||
modelsPath: string,
|
gpuId: string;
|
||||||
model: string,
|
saveImageAs: ImageFormat;
|
||||||
gpuId: string,
|
scale: string;
|
||||||
saveImageAs: ImageFormat,
|
}) => {
|
||||||
scale: string,
|
|
||||||
) => {
|
|
||||||
return [
|
return [
|
||||||
"-i",
|
"-i",
|
||||||
inputDir + slash + fullfileName,
|
inputDir + slash + fullfileName,
|
||||||
@ -85,15 +76,23 @@ export const getDoubleUpscaleArguments = (
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDoubleUpscaleSecondPassArguments = (
|
export const getDoubleUpscaleSecondPassArguments = ({
|
||||||
isAlpha: boolean,
|
isAlpha,
|
||||||
outFile: string,
|
outFile,
|
||||||
modelsPath: string,
|
modelsPath,
|
||||||
model: string,
|
model,
|
||||||
gpuId: string,
|
gpuId,
|
||||||
saveImageAs: ImageFormat,
|
saveImageAs,
|
||||||
scale: string,
|
scale,
|
||||||
) => {
|
}: {
|
||||||
|
isAlpha: boolean;
|
||||||
|
outFile: string;
|
||||||
|
modelsPath: string;
|
||||||
|
model: string;
|
||||||
|
gpuId: string;
|
||||||
|
saveImageAs: ImageFormat;
|
||||||
|
scale: string;
|
||||||
|
}) => {
|
||||||
return [
|
return [
|
||||||
"-i",
|
"-i",
|
||||||
isAlpha ? outFile + ".png" : outFile,
|
isAlpha ? outFile + ".png" : outFile,
|
||||||
@ -112,15 +111,23 @@ export const getDoubleUpscaleSecondPassArguments = (
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBatchArguments = (
|
export const getBatchArguments = ({
|
||||||
inputDir: string,
|
inputDir,
|
||||||
outputDir: string,
|
outputDir,
|
||||||
modelsPath: string,
|
modelsPath,
|
||||||
model: string,
|
model,
|
||||||
gpuId: string,
|
gpuId,
|
||||||
saveImageAs: ImageFormat,
|
saveImageAs,
|
||||||
scale: string,
|
scale,
|
||||||
) => {
|
}: {
|
||||||
|
inputDir: string;
|
||||||
|
outputDir: string;
|
||||||
|
modelsPath: string;
|
||||||
|
model: string;
|
||||||
|
gpuId: string;
|
||||||
|
saveImageAs: ImageFormat;
|
||||||
|
scale: string;
|
||||||
|
}) => {
|
||||||
return [
|
return [
|
||||||
"-i",
|
"-i",
|
||||||
inputDir,
|
inputDir,
|
||||||
|
338
package-lock.json
generated
338
package-lock.json
generated
@ -23,7 +23,6 @@
|
|||||||
"react-select": "^5.7.4",
|
"react-select": "^5.7.4",
|
||||||
"react-tooltip": "^5.18.1",
|
"react-tooltip": "^5.18.1",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"sharp": "^0.32.6",
|
|
||||||
"tailwind-scrollbar": "^3.0.4",
|
"tailwind-scrollbar": "^3.0.4",
|
||||||
"theme-change": "^2.5.0"
|
"theme-change": "^2.5.0"
|
||||||
},
|
},
|
||||||
@ -2132,11 +2131,6 @@
|
|||||||
"postcss": "^8.1.0"
|
"postcss": "^8.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/b4a": {
|
|
||||||
"version": "1.6.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
|
|
||||||
"integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw=="
|
|
||||||
},
|
|
||||||
"node_modules/babel-plugin-macros": {
|
"node_modules/babel-plugin-macros": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz",
|
||||||
@ -2169,6 +2163,7 @@
|
|||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@ -2196,6 +2191,8 @@
|
|||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||||
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer": "^5.5.0",
|
"buffer": "^5.5.0",
|
||||||
"inherits": "^2.0.4",
|
"inherits": "^2.0.4",
|
||||||
@ -2278,6 +2275,7 @@
|
|||||||
"version": "5.7.1",
|
"version": "5.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||||
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@ -2639,18 +2637,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/color": {
|
|
||||||
"version": "4.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
|
|
||||||
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-convert": "^2.0.1",
|
|
||||||
"color-string": "^1.9.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12.5.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-convert": {
|
"node_modules/color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
@ -2667,15 +2653,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||||
},
|
},
|
||||||
"node_modules/color-string": {
|
|
||||||
"version": "1.9.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
|
|
||||||
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-name": "^1.0.0",
|
|
||||||
"simple-swizzle": "^0.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/colord": {
|
"node_modules/colord": {
|
||||||
"version": "2.9.3",
|
"version": "2.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",
|
||||||
@ -2996,14 +2973,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/deep-extend": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/defer-to-connect": {
|
"node_modules/defer-to-connect": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
|
||||||
@ -3060,14 +3029,6 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/detect-libc": {
|
|
||||||
"version": "2.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
|
|
||||||
"integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/detect-node": {
|
"node_modules/detect-node": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
||||||
@ -3554,14 +3515,6 @@
|
|||||||
"url": "https://opencollective.com/unified"
|
"url": "https://opencollective.com/unified"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/expand-template": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
|
|
||||||
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/extend": {
|
"node_modules/extend": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||||
@ -3613,11 +3566,6 @@
|
|||||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fast-fifo": {
|
|
||||||
"version": "1.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
|
|
||||||
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="
|
|
||||||
},
|
|
||||||
"node_modules/fast-glob": {
|
"node_modules/fast-glob": {
|
||||||
"version": "3.3.2",
|
"version": "3.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
|
||||||
@ -3797,7 +3745,9 @@
|
|||||||
"node_modules/fs-constants": {
|
"node_modules/fs-constants": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
|
||||||
|
"dev": true,
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "9.1.0",
|
"version": "9.1.0",
|
||||||
@ -3902,11 +3852,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/github-from-package": {
|
|
||||||
"version": "0.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
|
||||||
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="
|
|
||||||
},
|
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
@ -4303,6 +4248,7 @@
|
|||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||||
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@ -4354,12 +4300,8 @@
|
|||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
},
|
"dev": true
|
||||||
"node_modules/ini": {
|
|
||||||
"version": "1.3.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
|
||||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
|
||||||
},
|
},
|
||||||
"node_modules/inline-style-parser": {
|
"node_modules/inline-style-parser": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
@ -5789,6 +5731,7 @@
|
|||||||
"version": "1.2.8",
|
"version": "1.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||||
|
"dev": true,
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
@ -5837,11 +5780,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mkdirp-classic": {
|
|
||||||
"version": "0.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
|
||||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
|
||||||
},
|
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
@ -5874,11 +5812,6 @@
|
|||||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/napi-build-utils": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
|
||||||
},
|
|
||||||
"node_modules/next": {
|
"node_modules/next": {
|
||||||
"version": "13.5.6",
|
"version": "13.5.6",
|
||||||
"resolved": "https://registry.npmjs.org/next/-/next-13.5.6.tgz",
|
"resolved": "https://registry.npmjs.org/next/-/next-13.5.6.tgz",
|
||||||
@ -5953,31 +5886,6 @@
|
|||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-abi": {
|
|
||||||
"version": "3.54.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz",
|
|
||||||
"integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==",
|
|
||||||
"dependencies": {
|
|
||||||
"semver": "^7.3.5"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-abi/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-addon-api": {
|
"node_modules/node-addon-api": {
|
||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
@ -6375,62 +6283,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||||
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
|
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
|
||||||
},
|
},
|
||||||
"node_modules/prebuild-install": {
|
|
||||||
"version": "7.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
|
|
||||||
"integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
|
|
||||||
"dependencies": {
|
|
||||||
"detect-libc": "^2.0.0",
|
|
||||||
"expand-template": "^2.0.3",
|
|
||||||
"github-from-package": "0.0.0",
|
|
||||||
"minimist": "^1.2.3",
|
|
||||||
"mkdirp-classic": "^0.5.3",
|
|
||||||
"napi-build-utils": "^1.0.1",
|
|
||||||
"node-abi": "^3.3.0",
|
|
||||||
"pump": "^3.0.0",
|
|
||||||
"rc": "^1.2.7",
|
|
||||||
"simple-get": "^4.0.0",
|
|
||||||
"tar-fs": "^2.0.0",
|
|
||||||
"tunnel-agent": "^0.6.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"prebuild-install": "bin.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prebuild-install/node_modules/chownr": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
|
||||||
},
|
|
||||||
"node_modules/prebuild-install/node_modules/tar-fs": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
|
||||||
"dependencies": {
|
|
||||||
"chownr": "^1.1.1",
|
|
||||||
"mkdirp-classic": "^0.5.2",
|
|
||||||
"pump": "^3.0.0",
|
|
||||||
"tar-stream": "^2.1.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prebuild-install/node_modules/tar-stream": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"bl": "^4.0.3",
|
|
||||||
"end-of-stream": "^1.4.1",
|
|
||||||
"fs-constants": "^1.0.0",
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"readable-stream": "^3.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.2.5",
|
"version": "3.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
|
||||||
@ -6627,11 +6479,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/queue-tick": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag=="
|
|
||||||
},
|
|
||||||
"node_modules/quick-lru": {
|
"node_modules/quick-lru": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
|
||||||
@ -6643,20 +6490,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rc": {
|
|
||||||
"version": "1.2.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
|
||||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
|
||||||
"dependencies": {
|
|
||||||
"deep-extend": "^0.6.0",
|
|
||||||
"ini": "~1.3.0",
|
|
||||||
"minimist": "^1.2.0",
|
|
||||||
"strip-json-comments": "~2.0.1"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rc": "cli.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "18.2.0",
|
"version": "18.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
|
||||||
@ -6808,6 +6641,8 @@
|
|||||||
"version": "3.6.2",
|
"version": "3.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inherits": "^2.0.3",
|
"inherits": "^2.0.3",
|
||||||
"string_decoder": "^1.1.1",
|
"string_decoder": "^1.1.1",
|
||||||
@ -7098,47 +6933,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sharp": {
|
|
||||||
"version": "0.32.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz",
|
|
||||||
"integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"dependencies": {
|
|
||||||
"color": "^4.2.3",
|
|
||||||
"detect-libc": "^2.0.2",
|
|
||||||
"node-addon-api": "^6.1.0",
|
|
||||||
"prebuild-install": "^7.1.1",
|
|
||||||
"semver": "^7.5.4",
|
|
||||||
"simple-get": "^4.0.1",
|
|
||||||
"tar-fs": "^3.0.4",
|
|
||||||
"tunnel-agent": "^0.6.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14.15.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/libvips"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/sharp/node_modules/node-addon-api": {
|
|
||||||
"version": "6.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
|
|
||||||
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA=="
|
|
||||||
},
|
|
||||||
"node_modules/sharp/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/shebang-command": {
|
"node_modules/shebang-command": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||||
@ -7163,62 +6957,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||||
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
||||||
},
|
},
|
||||||
"node_modules/simple-concat": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/simple-get": {
|
|
||||||
"version": "4.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
|
|
||||||
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"decompress-response": "^6.0.0",
|
|
||||||
"once": "^1.3.1",
|
|
||||||
"simple-concat": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/simple-swizzle": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
|
|
||||||
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
|
|
||||||
"dependencies": {
|
|
||||||
"is-arrayish": "^0.3.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/simple-swizzle/node_modules/is-arrayish": {
|
|
||||||
"version": "0.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
|
||||||
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
|
|
||||||
},
|
|
||||||
"node_modules/simple-update-notifier": {
|
"node_modules/simple-update-notifier": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
|
||||||
@ -7340,19 +7078,12 @@
|
|||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/streamx": {
|
|
||||||
"version": "2.15.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz",
|
|
||||||
"integrity": "sha512-q+vQL4AAz+FdfT137VF69Cc/APqUbxy+MDOImRrMvchJpigHj9GksgDU2LYbO9rx7RX6osWgxJB2WxhYv4SZAw==",
|
|
||||||
"dependencies": {
|
|
||||||
"fast-fifo": "^1.1.0",
|
|
||||||
"queue-tick": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string_decoder": {
|
"node_modules/string_decoder": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"safe-buffer": "~5.2.0"
|
"safe-buffer": "~5.2.0"
|
||||||
}
|
}
|
||||||
@ -7428,14 +7159,6 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/strip-json-comments": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/style-to-object": {
|
"node_modules/style-to-object": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.5.tgz",
|
||||||
@ -7646,26 +7369,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar-fs": {
|
|
||||||
"version": "3.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz",
|
|
||||||
"integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==",
|
|
||||||
"dependencies": {
|
|
||||||
"mkdirp-classic": "^0.5.2",
|
|
||||||
"pump": "^3.0.0",
|
|
||||||
"tar-stream": "^3.1.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tar-stream": {
|
|
||||||
"version": "3.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz",
|
|
||||||
"integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"b4a": "^1.6.4",
|
|
||||||
"fast-fifo": "^1.2.0",
|
|
||||||
"streamx": "^2.15.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/temp-file": {
|
"node_modules/temp-file": {
|
||||||
"version": "3.4.0",
|
"version": "3.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.4.0.tgz",
|
||||||
@ -7793,17 +7496,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
|
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
|
||||||
},
|
},
|
||||||
"node_modules/tunnel-agent": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "^5.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/type-fest": {
|
"node_modules/type-fest": {
|
||||||
"version": "0.13.1",
|
"version": "0.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
||||||
|
@ -237,7 +237,6 @@
|
|||||||
"react-select": "^5.7.4",
|
"react-select": "^5.7.4",
|
||||||
"react-tooltip": "^5.18.1",
|
"react-tooltip": "^5.18.1",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"sharp": "^0.32.6",
|
|
||||||
"tailwind-scrollbar": "^3.0.4",
|
"tailwind-scrollbar": "^3.0.4",
|
||||||
"theme-change": "^2.5.0"
|
"theme-change": "^2.5.0"
|
||||||
},
|
},
|
||||||
|
@ -5,9 +5,16 @@ export const customModelsPathAtom = atomWithStorage<string | null>(
|
|||||||
"customModelsPath",
|
"customModelsPath",
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4");
|
export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4");
|
||||||
|
|
||||||
export const batchModeAtom = atom<boolean>(false);
|
export const batchModeAtom = atom<boolean>(false);
|
||||||
export const outputPathAtom = atom<string | null>("");
|
|
||||||
|
export const savedOutputPathAtom = atomWithStorage<string | null>(
|
||||||
|
"savedOutputPath",
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
|
||||||
export const progressAtom = atom<string>("");
|
export const progressAtom = atom<string>("");
|
||||||
|
|
||||||
export const rememberOutputFolderAtom = atomWithStorage<boolean>(
|
export const rememberOutputFolderAtom = atomWithStorage<boolean>(
|
||||||
|
@ -11,15 +11,10 @@ export function CompressionInput({
|
|||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<div className="flex gap-1 text-sm font-medium uppercase">
|
<div className="flex gap-1 text-sm font-medium uppercase">
|
||||||
<p className="shrink-0">Image Compression ({compression}%)</p>
|
<p className="shrink-0">Image Compression ({compression}%)</p>
|
||||||
<p className="badge-primary badge text-[10px] font-medium">
|
|
||||||
EXPERIMENTAL
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
{compression > 0 && (
|
{compression > 0 && (
|
||||||
<p className="text-xs text-base-content/80">
|
<p className="text-xs text-base-content/80">
|
||||||
This option can cause color issues with some images. For PNGs, if you
|
PNG compression is not supported at the moment.
|
||||||
use compression, they'll use indexed colors. Keep compression to 0 for
|
|
||||||
PNGs for lossless quality.
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<input
|
<input
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
import { customWidthAtom, useCustomWidthAtom } from "@/atoms/userSettingsAtom";
|
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
|
|
||||||
export function CustomResolutionInput() {
|
|
||||||
const [useCustomWidth, setUseCustomWidth] = useAtom(useCustomWidthAtom);
|
|
||||||
const [customWidth, setCustomWidth] = useAtom(customWidthAtom);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="flex flex-col gap-1">
|
|
||||||
<p className="text-sm font-medium">CUSTOM OUTPUT WIDTH</p>
|
|
||||||
<p className="text-xs text-base-content/80">
|
|
||||||
<b>REQUIRES RESTART</b>
|
|
||||||
<br />
|
|
||||||
Use a custom width for the output images. The height will be adjusted
|
|
||||||
automatically. Enabling this will override the scale setting.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
className="toggle"
|
|
||||||
checked={useCustomWidth}
|
|
||||||
onClick={(e) => {
|
|
||||||
if (!e.currentTarget.checked) {
|
|
||||||
localStorage.removeItem("customWidth");
|
|
||||||
}
|
|
||||||
setUseCustomWidth(!useCustomWidth);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
value={customWidth}
|
|
||||||
disabled={!useCustomWidth}
|
|
||||||
onChange={(e) => {
|
|
||||||
if (e.currentTarget.value === "") {
|
|
||||||
setUseCustomWidth(false);
|
|
||||||
setCustomWidth(null);
|
|
||||||
localStorage.removeItem("customWidth");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setCustomWidth(parseInt(e.currentTarget.value));
|
|
||||||
}}
|
|
||||||
step="1"
|
|
||||||
className="input input-primary mt-2 w-full"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,31 +1,22 @@
|
|||||||
import { useCustomWidthAtom } from "@/atoms/userSettingsAtom";
|
|
||||||
import { useAtom } from "jotai";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
type ImageScaleSelectProps = {
|
type ImageScaleSelectProps = {
|
||||||
scale: "4" | "2" | "3";
|
scale: "4" | "2" | "3";
|
||||||
setScale: (arg: "4" | "2" | "3") => void;
|
setScale: (arg: "4" | "2" | "3") => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
||||||
const [useCustomWidth, setUseCustomWidth] = useAtom(useCustomWidthAtom);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${useCustomWidth && "opacity-50"}`}>
|
<div>
|
||||||
<div className="flex flex-row gap-1">
|
<div className="flex flex-row gap-1">
|
||||||
<p className="text-sm font-medium">
|
<p className="text-sm font-medium">IMAGE SCALE ({scale}X)</p>
|
||||||
IMAGE SCALE {useCustomWidth && "DISABLED"}
|
|
||||||
</p>
|
|
||||||
{/*
|
{/*
|
||||||
<p className="badge-primary badge text-[10px] font-medium">
|
<p className="badge-primary badge text-[10px] font-medium">
|
||||||
EXPERIMENTAL
|
EXPERIMENTAL
|
||||||
</p> */}
|
</p> */}
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
disabled={useCustomWidth}
|
|
||||||
type="range"
|
type="range"
|
||||||
min="1"
|
min="1"
|
||||||
max="4"
|
max="16"
|
||||||
value={scale}
|
value={scale}
|
||||||
onChange={(e: any) => {
|
onChange={(e: any) => {
|
||||||
setScale(e.target.value.toString());
|
setScale(e.target.value.toString());
|
||||||
@ -34,10 +25,11 @@ export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
|||||||
className="range range-primary mt-2"
|
className="range range-primary mt-2"
|
||||||
/>
|
/>
|
||||||
<div className="flex w-full justify-between px-2 text-xs font-semibold text-base-content">
|
<div className="flex w-full justify-between px-2 text-xs font-semibold text-base-content">
|
||||||
<span>1x</span>
|
<span>1</span>
|
||||||
<span>2x</span>
|
<span>4</span>
|
||||||
<span>3x</span>
|
<span>8</span>
|
||||||
<span>4x</span>
|
<span>12</span>
|
||||||
|
<span>16</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
type ProcessImageToggleProps = {
|
|
||||||
noImageProcessing: boolean;
|
|
||||||
setNoImageProcessing: (arg: any) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
const ProcessImageToggle = ({
|
|
||||||
noImageProcessing,
|
|
||||||
setNoImageProcessing,
|
|
||||||
}: ProcessImageToggleProps) => {
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col gap-2">
|
|
||||||
<p className="text-sm font-medium">DON'T POST-PROCESS IMAGE</p>
|
|
||||||
<p className="text-xs text-base-content/80">
|
|
||||||
If enabled, the image will not be converted or scaled or post-processed.
|
|
||||||
This will output the original AI upscaling result as-is. Use this if
|
|
||||||
you're having issues with file-size or color banding.
|
|
||||||
</p>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
className="toggle"
|
|
||||||
checked={noImageProcessing}
|
|
||||||
onClick={() => {
|
|
||||||
setNoImageProcessing(!noImageProcessing);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ProcessImageToggle;
|
|
@ -1,20 +1,22 @@
|
|||||||
import React from "react";
|
import {
|
||||||
|
savedOutputPathAtom,
|
||||||
|
rememberOutputFolderAtom,
|
||||||
|
} from "@/atoms/userSettingsAtom";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
|
||||||
type SaveOutputFolderToggleProps = {
|
export function SaveOutputFolderToggle() {
|
||||||
rememberOutputFolder: boolean;
|
const [outputPath, setOutputPath] = useAtom(savedOutputPathAtom);
|
||||||
setRememberOutputFolder: (arg: any) => void;
|
const [rememberOutputFolder, setRememberOutputFolder] = useAtom(
|
||||||
};
|
rememberOutputFolderAtom,
|
||||||
|
);
|
||||||
export function SaveOutputFolderToggle({
|
|
||||||
rememberOutputFolder,
|
|
||||||
setRememberOutputFolder,
|
|
||||||
}: SaveOutputFolderToggleProps) {
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<p className="text-sm font-medium">SAVE OUTPUT FOLDER</p>
|
<p className="text-sm font-medium">SAVE OUTPUT FOLDER</p>
|
||||||
<p className="text-xs text-base-content/80">
|
<p className="text-xs text-base-content/80">
|
||||||
If enabled, the output folder will be remembered between sessions.
|
If enabled, the output folder will be remembered between sessions.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>{outputPath}</p>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="toggle"
|
className="toggle"
|
||||||
@ -22,13 +24,13 @@ export function SaveOutputFolderToggle({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRememberOutputFolder((oldValue) => {
|
setRememberOutputFolder((oldValue) => {
|
||||||
if (oldValue === true) {
|
if (oldValue === true) {
|
||||||
localStorage.removeItem("lastOutputFolderPath");
|
setOutputPath("");
|
||||||
}
|
}
|
||||||
return !oldValue;
|
return !oldValue;
|
||||||
});
|
});
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"rememberOutputFolder",
|
"rememberOutputFolder",
|
||||||
JSON.stringify(!rememberOutputFolder)
|
JSON.stringify(!rememberOutputFolder),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -21,10 +21,8 @@ import { CompressionInput } from "./CompressionInput";
|
|||||||
import OverwriteToggle from "./OverwriteToggle";
|
import OverwriteToggle from "./OverwriteToggle";
|
||||||
import { UpscaylCloudModal } from "../UpscaylCloudModal";
|
import { UpscaylCloudModal } from "../UpscaylCloudModal";
|
||||||
import { ResetSettings } from "./ResetSettings";
|
import { ResetSettings } from "./ResetSettings";
|
||||||
import ProcessImageToggle from "./ProcessImageToggle";
|
|
||||||
import { featureFlags } from "@common/feature-flags";
|
import { featureFlags } from "@common/feature-flags";
|
||||||
import TurnOffNotificationsToggle from "./TurnOffNotificationsToggle";
|
import TurnOffNotificationsToggle from "./TurnOffNotificationsToggle";
|
||||||
import { CustomResolutionInput } from "./CustomResolutionInput";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
batchMode: boolean;
|
batchMode: boolean;
|
||||||
@ -65,7 +63,6 @@ function SettingsTab({
|
|||||||
label: null,
|
label: null,
|
||||||
value: null,
|
value: null,
|
||||||
});
|
});
|
||||||
const [rememberOutputFolder, setRememberOutputFolder] = useState(false);
|
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
|
|
||||||
const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom);
|
const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom);
|
||||||
@ -126,22 +123,6 @@ function SettingsTab({
|
|||||||
setGpuId(currentlySavedGpuId);
|
setGpuId(currentlySavedGpuId);
|
||||||
logit("⚙️ Getting gpuId from localStorage: ", currentlySavedGpuId);
|
logit("⚙️ Getting gpuId from localStorage: ", currentlySavedGpuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!localStorage.getItem("rememberOutputFolder")) {
|
|
||||||
logit("⚙️ Setting rememberOutputFolder to false");
|
|
||||||
localStorage.setItem("rememberOutputFolder", "false");
|
|
||||||
} else {
|
|
||||||
const currentlySavedRememberOutputFolder = localStorage.getItem(
|
|
||||||
"rememberOutputFolder",
|
|
||||||
);
|
|
||||||
logit(
|
|
||||||
"⚙️ Getting rememberOutputFolder from localStorage: ",
|
|
||||||
currentlySavedRememberOutputFolder,
|
|
||||||
);
|
|
||||||
setRememberOutputFolder(
|
|
||||||
currentlySavedRememberOutputFolder === "true" ? true : false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// HANDLERS
|
// HANDLERS
|
||||||
@ -210,29 +191,15 @@ function SettingsTab({
|
|||||||
setExportType={setExportType}
|
setExportType={setExportType}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ProcessImageToggle
|
|
||||||
noImageProcessing={noImageProcessing}
|
|
||||||
setNoImageProcessing={setNoImageProcessing}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{!noImageProcessing && (
|
|
||||||
<>
|
|
||||||
{/* IMAGE SCALE */}
|
{/* IMAGE SCALE */}
|
||||||
<ImageScaleSelect scale={scale} setScale={setScale} />
|
<ImageScaleSelect scale={scale} setScale={setScale} />
|
||||||
|
|
||||||
<CustomResolutionInput />
|
|
||||||
|
|
||||||
<CompressionInput
|
<CompressionInput
|
||||||
compression={compression}
|
compression={compression}
|
||||||
handleCompressionChange={handleCompressionChange}
|
handleCompressionChange={handleCompressionChange}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<SaveOutputFolderToggle
|
<SaveOutputFolderToggle />
|
||||||
rememberOutputFolder={rememberOutputFolder}
|
|
||||||
setRememberOutputFolder={setRememberOutputFolder}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<OverwriteToggle />
|
<OverwriteToggle />
|
||||||
<TurnOffNotificationsToggle />
|
<TurnOffNotificationsToggle />
|
||||||
|
@ -7,18 +7,19 @@ import { modelsListAtom } from "../../../atoms/modelsListAtom";
|
|||||||
import useLog from "../../hooks/useLog";
|
import useLog from "../../hooks/useLog";
|
||||||
import {
|
import {
|
||||||
noImageProcessingAtom,
|
noImageProcessingAtom,
|
||||||
outputPathAtom,
|
savedOutputPathAtom,
|
||||||
progressAtom,
|
progressAtom,
|
||||||
|
rememberOutputFolderAtom,
|
||||||
scaleAtom,
|
scaleAtom,
|
||||||
} from "../../../atoms/userSettingsAtom";
|
} from "../../../atoms/userSettingsAtom";
|
||||||
import { featureFlags } from "@common/feature-flags";
|
import { featureFlags } from "@common/feature-flags";
|
||||||
import getModelScale from "@common/check-model-scale";
|
import getModelScale from "@common/check-model-scale";
|
||||||
|
import COMMAND from "@common/commands";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
selectImageHandler: () => Promise<void>;
|
selectImageHandler: () => Promise<void>;
|
||||||
selectFolderHandler: () => Promise<void>;
|
selectFolderHandler: () => Promise<void>;
|
||||||
handleModelChange: (e: any) => void;
|
handleModelChange: (e: any) => void;
|
||||||
outputHandler: () => Promise<void>;
|
|
||||||
upscaylHandler: () => Promise<void>;
|
upscaylHandler: () => Promise<void>;
|
||||||
batchMode: boolean;
|
batchMode: boolean;
|
||||||
setBatchMode: React.Dispatch<React.SetStateAction<boolean>>;
|
setBatchMode: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
@ -39,7 +40,6 @@ function LeftPaneImageSteps({
|
|||||||
selectImageHandler,
|
selectImageHandler,
|
||||||
selectFolderHandler,
|
selectFolderHandler,
|
||||||
handleModelChange,
|
handleModelChange,
|
||||||
outputHandler,
|
|
||||||
upscaylHandler,
|
upscaylHandler,
|
||||||
batchMode,
|
batchMode,
|
||||||
setBatchMode,
|
setBatchMode,
|
||||||
@ -63,14 +63,25 @@ function LeftPaneImageSteps({
|
|||||||
const modelOptions = useAtomValue(modelsListAtom);
|
const modelOptions = useAtomValue(modelsListAtom);
|
||||||
const scale = useAtomValue(scaleAtom);
|
const scale = useAtomValue(scaleAtom);
|
||||||
const noImageProcessing = useAtomValue(noImageProcessingAtom);
|
const noImageProcessing = useAtomValue(noImageProcessingAtom);
|
||||||
const [outputPath, setOutputPath] = useAtom(outputPathAtom);
|
const [outputPath, setOutputPath] = useAtom(savedOutputPathAtom);
|
||||||
const [progress, setProgress] = useAtom(progressAtom);
|
const [progress, setProgress] = useAtom(progressAtom);
|
||||||
|
const rememberOutputFolder = useAtomValue(rememberOutputFolderAtom);
|
||||||
|
|
||||||
const [targetWidth, setTargetWidth] = useState<number>(null);
|
const [targetWidth, setTargetWidth] = useState<number>(null);
|
||||||
const [targetHeight, setTargetHeight] = useState<number>(null);
|
const [targetHeight, setTargetHeight] = useState<number>(null);
|
||||||
|
|
||||||
const { logit } = useLog();
|
const { logit } = useLog();
|
||||||
|
|
||||||
|
const outputHandler = async () => {
|
||||||
|
var path = await window.electron.invoke(COMMAND.SELECT_FOLDER);
|
||||||
|
if (path !== null) {
|
||||||
|
logit("🗂 Setting Output Path: ", path);
|
||||||
|
setOutputPath(path);
|
||||||
|
} else {
|
||||||
|
setOutputPath(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
themeChange(false);
|
themeChange(false);
|
||||||
|
|
||||||
@ -166,7 +177,9 @@ function LeftPaneImageSteps({
|
|||||||
className="toggle"
|
className="toggle"
|
||||||
defaultChecked={batchMode}
|
defaultChecked={batchMode}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
setOutputPath("");
|
setOutputPath("");
|
||||||
|
}
|
||||||
setProgress("");
|
setProgress("");
|
||||||
setBatchMode((oldValue) => !oldValue);
|
setBatchMode((oldValue) => !oldValue);
|
||||||
}}
|
}}
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import Select from "react-select";
|
|
||||||
|
|
||||||
interface IProps {
|
|
||||||
progress: string;
|
|
||||||
selectVideoHandler: () => Promise<void>;
|
|
||||||
handleModelChange: (e: any) => void;
|
|
||||||
handleDrop: (e: any) => void;
|
|
||||||
outputHandler: () => Promise<void>;
|
|
||||||
upscaylHandler: () => Promise<void>;
|
|
||||||
videoPath: string;
|
|
||||||
outputPath: string;
|
|
||||||
model: string;
|
|
||||||
isVideo: boolean;
|
|
||||||
setIsVideo: (arg: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
function LeftPaneVideoSteps({
|
|
||||||
progress,
|
|
||||||
selectVideoHandler,
|
|
||||||
handleModelChange,
|
|
||||||
handleDrop,
|
|
||||||
outputHandler,
|
|
||||||
upscaylHandler,
|
|
||||||
videoPath,
|
|
||||||
outputPath,
|
|
||||||
model,
|
|
||||||
isVideo,
|
|
||||||
setIsVideo,
|
|
||||||
}: IProps) {
|
|
||||||
const customStyles = {
|
|
||||||
option: (provided, state) => ({
|
|
||||||
...provided,
|
|
||||||
borderBottom: "1px dotted pink",
|
|
||||||
color: state.isSelected ? "red" : "blue",
|
|
||||||
padding: 20,
|
|
||||||
}),
|
|
||||||
control: () => ({
|
|
||||||
// none of react-select's styles are passed to <Control />
|
|
||||||
width: 200,
|
|
||||||
}),
|
|
||||||
singleValue: (provided, state) => {
|
|
||||||
const opacity = state.isDisabled ? 0.5 : 1;
|
|
||||||
const transition = "opacity 300ms";
|
|
||||||
|
|
||||||
return { ...provided, opacity, transition };
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const modelOptions = [
|
|
||||||
{ label: "2x Digital Art", value: "realesr-animevideov3-x2" },
|
|
||||||
{ label: "3x Digital Art", value: "realesr-animevideov3-x3" },
|
|
||||||
{ label: "4x Digital Art", value: "realesr-animevideov3-x4" },
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
|
|
||||||
{/* STEP 1 */}
|
|
||||||
<div data-tip={videoPath}>
|
|
||||||
<p className="step-heading">Step 1</p>
|
|
||||||
<button className="btn-primary btn" onClick={selectVideoHandler}>
|
|
||||||
Select Video
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* STEP 2 */}
|
|
||||||
<div className="animate-step-in">
|
|
||||||
<p className="step-heading">Step 2</p>
|
|
||||||
<p className="mb-2 text-sm">Select Scaling</p>
|
|
||||||
|
|
||||||
<Select
|
|
||||||
options={modelOptions}
|
|
||||||
components={{
|
|
||||||
IndicatorSeparator: () => null,
|
|
||||||
DropdownIndicator: () => null,
|
|
||||||
}}
|
|
||||||
onChange={handleModelChange}
|
|
||||||
className="react-select-container"
|
|
||||||
classNamePrefix="react-select"
|
|
||||||
defaultValue={modelOptions[0]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* STEP 3 */}
|
|
||||||
<div className="animate-step-in" data-tip={outputPath}>
|
|
||||||
<p className="step-heading">Step 3</p>
|
|
||||||
<p className="mb-2 text-sm">Defaults to Video's path</p>
|
|
||||||
<button className="btn-primary btn" onClick={outputHandler}>
|
|
||||||
Set Output Folder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* STEP 4 */}
|
|
||||||
<div className="animate-step-in">
|
|
||||||
<p className="step-heading">Step 4</p>
|
|
||||||
<button
|
|
||||||
className="btn-accent btn"
|
|
||||||
onClick={upscaylHandler}
|
|
||||||
disabled={progress.length > 0}>
|
|
||||||
{progress.length > 0 ? "Upscayling⏳" : "Upscayl"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default LeftPaneVideoSteps;
|
|
@ -19,11 +19,12 @@ import {
|
|||||||
compressionAtom,
|
compressionAtom,
|
||||||
dontShowCloudModalAtom,
|
dontShowCloudModalAtom,
|
||||||
noImageProcessingAtom,
|
noImageProcessingAtom,
|
||||||
outputPathAtom,
|
savedOutputPathAtom,
|
||||||
overwriteAtom,
|
overwriteAtom,
|
||||||
progressAtom,
|
progressAtom,
|
||||||
scaleAtom,
|
scaleAtom,
|
||||||
viewTypeAtom,
|
viewTypeAtom,
|
||||||
|
rememberOutputFolderAtom,
|
||||||
} from "../atoms/userSettingsAtom";
|
} from "../atoms/userSettingsAtom";
|
||||||
import useLog from "../components/hooks/useLog";
|
import useLog from "../components/hooks/useLog";
|
||||||
import { UpscaylCloudModal } from "../components/UpscaylCloudModal";
|
import { UpscaylCloudModal } from "../components/UpscaylCloudModal";
|
||||||
@ -66,7 +67,7 @@ const Home = () => {
|
|||||||
const [cursorPosition, setCursorPosition] = useState({ x: 0, y: 0 });
|
const [cursorPosition, setCursorPosition] = useState({ x: 0, y: 0 });
|
||||||
|
|
||||||
// ATOMIC STATES
|
// ATOMIC STATES
|
||||||
const [outputPath, setOutputPath] = useAtom(outputPathAtom);
|
const [outputPath, setOutputPath] = useAtom(savedOutputPathAtom);
|
||||||
const [compression, setCompression] = useAtom(compressionAtom);
|
const [compression, setCompression] = useAtom(compressionAtom);
|
||||||
const [progress, setProgress] = useAtom(progressAtom);
|
const [progress, setProgress] = useAtom(progressAtom);
|
||||||
const [batchMode, setBatchMode] = useAtom(batchModeAtom);
|
const [batchMode, setBatchMode] = useAtom(batchModeAtom);
|
||||||
@ -81,6 +82,7 @@ const Home = () => {
|
|||||||
const [showNewsModal, setShowNewsModal] = useAtom(showNewsModalAtom);
|
const [showNewsModal, setShowNewsModal] = useAtom(showNewsModalAtom);
|
||||||
const viewType = useAtomValue(viewTypeAtom);
|
const viewType = useAtomValue(viewTypeAtom);
|
||||||
const lensSize = useAtomValue(lensSizeAtom);
|
const lensSize = useAtomValue(lensSizeAtom);
|
||||||
|
const rememberOutputFolder = useAtomValue(rememberOutputFolderAtom);
|
||||||
|
|
||||||
const { logit } = useLog();
|
const { logit } = useLog();
|
||||||
|
|
||||||
@ -275,19 +277,6 @@ const Home = () => {
|
|||||||
}
|
}
|
||||||
}, [news]);
|
}, [news]);
|
||||||
|
|
||||||
// CONFIGURE SAVED OUTPUT PATH
|
|
||||||
useEffect(() => {
|
|
||||||
const rememberOutputFolder = localStorage.getItem("rememberOutputFolder");
|
|
||||||
const lastOutputFolderPath = localStorage.getItem("lastOutputFolderPath");
|
|
||||||
if (rememberOutputFolder === "true") {
|
|
||||||
logit("🧠 Recalling Output Folder: ", lastOutputFolderPath);
|
|
||||||
setOutputPath(lastOutputFolderPath);
|
|
||||||
} else {
|
|
||||||
setOutputPath("");
|
|
||||||
localStorage.removeItem("lastOutputFolderPath");
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// LOADING STATE
|
// LOADING STATE
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -340,8 +329,10 @@ const Home = () => {
|
|||||||
var dirname = path.match(/(.*)[\/\\]/)[1] || "";
|
var dirname = path.match(/(.*)[\/\\]/)[1] || "";
|
||||||
logit("📁 Selected Image Directory: ", dirname);
|
logit("📁 Selected Image Directory: ", dirname);
|
||||||
if (!featureFlags.APP_STORE_BUILD) {
|
if (!featureFlags.APP_STORE_BUILD) {
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
setOutputPath(dirname);
|
setOutputPath(dirname);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
validateImagePath(path);
|
validateImagePath(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -351,12 +342,16 @@ const Home = () => {
|
|||||||
if (path !== null) {
|
if (path !== null) {
|
||||||
logit("🖼 Selected Folder Path: ", path);
|
logit("🖼 Selected Folder Path: ", path);
|
||||||
setBatchFolderPath(path);
|
setBatchFolderPath(path);
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
setOutputPath(path);
|
setOutputPath(path);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logit("🚫 Folder selection cancelled");
|
logit("🚫 Folder selection cancelled");
|
||||||
setBatchFolderPath("");
|
setBatchFolderPath("");
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
setOutputPath("");
|
setOutputPath("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleModelChange = (e: any) => {
|
const handleModelChange = (e: any) => {
|
||||||
@ -412,7 +407,11 @@ const Home = () => {
|
|||||||
setImagePath(filePath);
|
setImagePath(filePath);
|
||||||
var dirname = filePath.match(/(.*)[\/\\]/)[1] || "";
|
var dirname = filePath.match(/(.*)[\/\\]/)[1] || "";
|
||||||
logit("🗂 Setting output path: ", dirname);
|
logit("🗂 Setting output path: ", dirname);
|
||||||
if (!featureFlags.APP_STORE_BUILD) setOutputPath(dirname);
|
if (!featureFlags.APP_STORE_BUILD) {
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
|
setOutputPath(dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
validateImagePath(filePath);
|
validateImagePath(filePath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -433,22 +432,9 @@ const Home = () => {
|
|||||||
setImagePath(filePath);
|
setImagePath(filePath);
|
||||||
var dirname = filePath.match(/(.*)[\/\\]/)[1] || "";
|
var dirname = filePath.match(/(.*)[\/\\]/)[1] || "";
|
||||||
logit("🗂 Setting output path: ", dirname);
|
logit("🗂 Setting output path: ", dirname);
|
||||||
|
if (!rememberOutputFolder) {
|
||||||
setOutputPath(dirname);
|
setOutputPath(dirname);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const outputHandler = async () => {
|
|
||||||
var path = await window.electron.invoke(COMMAND.SELECT_FOLDER);
|
|
||||||
if (path !== null) {
|
|
||||||
logit("🗂 Setting Output Path: ", path);
|
|
||||||
setOutputPath(path);
|
|
||||||
const rememberOutputFolder = localStorage.getItem("rememberOutputFolder");
|
|
||||||
if (rememberOutputFolder) {
|
|
||||||
logit("🧠 Remembering Output Folder: ", path);
|
|
||||||
localStorage.setItem("lastOutputFolderPath", path);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setOutputPath("");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -564,7 +550,6 @@ const Home = () => {
|
|||||||
selectImageHandler={selectImageHandler}
|
selectImageHandler={selectImageHandler}
|
||||||
selectFolderHandler={selectFolderHandler}
|
selectFolderHandler={selectFolderHandler}
|
||||||
handleModelChange={handleModelChange}
|
handleModelChange={handleModelChange}
|
||||||
outputHandler={outputHandler}
|
|
||||||
upscaylHandler={upscaylHandler}
|
upscaylHandler={upscaylHandler}
|
||||||
batchMode={batchMode}
|
batchMode={batchMode}
|
||||||
setBatchMode={setBatchMode}
|
setBatchMode={setBatchMode}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user