π Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.
TypeScript aielectronesrgangigapixelgigapixel-imagesimageimage-upscalingtopazupscaleupscalerimageupscayl
Fix options
Nayam Amarshe8d34704d3862
diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.tsindex 47f19ce..5de1497 100644--- a/electron/commands/image-upscayl.ts+++ b/electron/commands/image-upscayl.ts@@ -2,6 +2,7 @@ import fs from "fs";import { modelsPath } from "../utils/get-resource-paths";import COMMAND from "../constants/commands";import {+ compression,customModelsFolderPath,folderPath,outputFolderPath,@@ -133,14 +134,16 @@ const imageUpscayl = async (event, payload) => {// Free up memoryupscayl.kill();try {- await convertAndScale(- inputDir + slash + fullfileName,- isAlpha ? outFile + ".png" : outFile,- outFile,- payload.scale,- saveImageAs,- onError- );+ if (saveImageAs !== "png" && scale !== "4" && compression !== 0) {+ await convertAndScale(+ inputDir + slash + fullfileName,+ isAlpha ? outFile + ".png" : outFile,+ outFile,+ payload.scale,+ saveImageAs,+ onError+ );+ }mainWindow.setProgressBar(-1);mainWindow.webContents.send(COMMAND.UPSCAYL_DONE,diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.tsindex 333018e..1d141e4 100644--- a/electron/utils/convert-and-scale.ts+++ b/electron/utils/convert-and-scale.ts@@ -36,8 +36,14 @@ const convertAndScale = async (limitInputPixels: false,}).toFormat(saveImageAs as keyof FormatEnum, {- quality: 100 - (compression === 100 ? 99 : compression),- compressionLevel,+ ...(saveImageAs === "jpg" && {+ quality: 100 - (compression === 100 ? 99 : compression),+ chromaSubsampling: "4:4:4",+ }),+ ...(saveImageAs === "png" && {+ compressionLevel,+ }),+ force: true,}).withMetadata({orientation: originalImage.orientation,