Skip to content

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

Fix [DOUBLE UPSCAYL] Wrong scale size being used #841

Nayam Amarshe4b3c0e209f2c
diff --git a/electron/commands/double-upscayl.ts b/electron/commands/double-upscayl.ts
index da3959e..a69cedb 100644
--- a/electron/commands/double-upscayl.ts
+++ b/electron/commands/double-upscayl.ts
@@ -29,7 +29,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
const tileSize = payload.tileSize;
const compression = payload.compression;
- const scale = parseInt(payload.scale) ** 2;
+ const scale = payload.scale;
const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : "";
const model = payload.model;
@@ -65,6 +65,8 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
? modelsPath
: savedCustomModelsPath ?? modelsPath,
model,
+ scale,
+ customWidth,
gpuId,
saveImageAs,
tileSize,
@@ -171,7 +173,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
model,
gpuId,
saveImageAs,
- scale: scale.toString(),
+ scale,
customWidth,
compression,
tileSize,
diff --git a/electron/utils/get-arguments.ts b/electron/utils/get-arguments.ts
index 3cf47b0..d571137 100644
--- a/electron/utils/get-arguments.ts
+++ b/electron/utils/get-arguments.ts
@@ -69,20 +69,26 @@ export const getDoubleUpscaleArguments = ({
fullfileName,
outFile,
modelsPath,
+ scale,
model,
gpuId,
saveImageAs,
+ customWidth,
tileSize,
}: {
inputDir: string;
fullfileName: string;
outFile: string;
modelsPath: string;
+ scale: string;
model: string;
gpuId: string;
saveImageAs: ImageFormat;
+ customWidth: string;
tileSize: number;
}) => {
+ const modelScale = getModelScale(model);
+ let includeScale = modelScale !== scale && !customWidth;
return [
// INPUT IMAGE
"-i",
@@ -90,6 +96,9 @@ export const getDoubleUpscaleArguments = ({
// OUTPUT IMAGE
"-o",
outFile,
+ // OUTPUT SCALE
+ includeScale ? "-s" : "",
+ includeScale ? scale : "",
// MODELS PATH
"-m",
modelsPath,
@@ -129,7 +138,7 @@ export const getDoubleUpscaleSecondPassArguments = ({
compression: string;
tileSize: number;
}) => {
- const modelScale = (parseInt(getModelScale(model)) ** 2).toString();
+ const modelScale = getModelScale(model);
let includeScale = modelScale !== scale && !customWidth;
return [
// INPUT IMAGE