From 00099928fb63d46df16465b612310b4b68a585bb Mon Sep 17 00:00:00 2001 From: Nayam Amarshe <25067102+NayamAmarshe@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:00:08 +0530 Subject: [PATCH] Fix #653 --- electron/commands/batch-upscayl.ts | 2 +- electron/commands/double-upscayl.ts | 2 +- electron/commands/image-upscayl.ts | 2 +- electron/utils/convert-and-scale.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/electron/commands/batch-upscayl.ts b/electron/commands/batch-upscayl.ts index 5ebe145..df099b5 100644 --- a/electron/commands/batch-upscayl.ts +++ b/electron/commands/batch-upscayl.ts @@ -155,7 +155,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => { )}.${saveImageAs}`, desiredScale, saveImageAs, - onError + isAlpha ); }); mainWindow.webContents.send( diff --git a/electron/commands/double-upscayl.ts b/electron/commands/double-upscayl.ts index 32815e9..7976881 100644 --- a/electron/commands/double-upscayl.ts +++ b/electron/commands/double-upscayl.ts @@ -157,7 +157,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => { outFile, desiredScale.toString(), saveImageAs, - onError + isAlpha ); mainWindow.setProgressBar(-1); mainWindow.webContents.send( diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.ts index 6cc3a5f..b4560bc 100644 --- a/electron/commands/image-upscayl.ts +++ b/electron/commands/image-upscayl.ts @@ -172,7 +172,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => { outFile, desiredScale, saveImageAs, - onError + isAlpha ); // Remove the png file (default) if the saveImageAs is not png // fs.access( diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.ts index f9f0292..cd6495d 100644 --- a/electron/utils/convert-and-scale.ts +++ b/electron/utils/convert-and-scale.ts @@ -10,10 +10,10 @@ const convertAndScale = async ( processedImagePath: string, scale: string, saveImageAs: ImageFormat, - onError: (error: any) => void + isAlpha: boolean ) => { - if (scale === "4" && compression === 0) { - logit("Skipping png compression for 4x scale and 0% compression"); + if (!isAlpha && scale === "4" && compression === 0) { + logit("Skipping compression for 4x scale and 0% compression"); return; } let originalImage: Metadata | undefined;