Skip to content

πŸ†™ Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.

Fix name logic

Nayam Amarshe938bc0d83ab5
diff --git a/electron/commands/batch-upscayl.ts b/electron/commands/batch-upscayl.ts
index 4c16df8..5caf5f2 100644
--- a/electron/commands/batch-upscayl.ts
+++ b/electron/commands/batch-upscayl.ts
@@ -46,7 +46,9 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : "";
- const outputFolderName = `upscayl_${saveImageAs}_${model}_${scale ? scale : ""}${useCustomWidth ? "px" : "x"}`;
+ const outputFolderName = `upscayl_${saveImageAs}_${model}_${
+ useCustomWidth ? `${customWidth}px` : `${scale}x`
+ }`;
outputFolderPath += slash + outputFolderName;
if (!fs.existsSync(outputFolderPath)) {
diff --git a/electron/commands/double-upscayl.ts b/electron/commands/double-upscayl.ts
index 7ca4e94..0a7de8e 100644
--- a/electron/commands/double-upscayl.ts
+++ b/electron/commands/double-upscayl.ts
@@ -55,15 +55,9 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
const customWidth = useCustomWidth ? payload.customWidth : "";
const outFile =
- outputDir +
- slash +
- fileName +
- "_upscayl_" +
- (scale ? scale : "") +
- (useCustomWidth ? "px_" : "x_") +
- model +
- "." +
- saveImageAs;
+ outputDir + slash + fileName + "_upscayl_" + useCustomWidth
+ ? `${customWidth}px_`
+ : `${scale}x_` + model + "." + saveImageAs;
// UPSCALE
let upscayl = spawnUpscayl(
diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.ts
index 13e0b9f..9e1f4ba 100644
--- a/electron/commands/image-upscayl.ts
+++ b/electron/commands/image-upscayl.ts
@@ -61,18 +61,12 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : "";
- const desiredScale = payload.scale;
+ const scale = payload.scale;
const outFile =
- outputDir +
- slash +
- fileName +
- "_upscayl_" +
- desiredScale +
- (useCustomWidth ? "px_" : "x_") +
- model +
- "." +
- saveImageAs;
+ outputDir + slash + fileName + "_upscayl_" + useCustomWidth
+ ? `${customWidth}px_`
+ : `${scale}x_` + model + "." + saveImageAs;
// UPSCALE
if (fs.existsSync(outFile) && !overwrite) {
@@ -96,8 +90,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
outputDir,
fullfileName,
fileName,
- scale: desiredScale,
- desiredScale,
+ scale,
outFile,
compression: savedCompression,
}),
@@ -111,7 +104,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
? modelsPath
: savedCustomModelsPath ?? modelsPath,
model,
- scale: desiredScale,
+ scale,
gpuId,
saveImageAs,
customWidth,