1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-12 01:40:53 +01:00

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

This commit is contained in:
Nayam Amarshe 2024-05-29 23:18:13 +05:30
parent d75bd9ac8f
commit 4b3c0e209f
2 changed files with 14 additions and 3 deletions

View File

@ -29,7 +29,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
const tileSize = payload.tileSize; const tileSize = payload.tileSize;
const compression = payload.compression; const compression = payload.compression;
const scale = parseInt(payload.scale) ** 2; const scale = payload.scale;
const useCustomWidth = payload.useCustomWidth; const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : ""; const customWidth = useCustomWidth ? payload.customWidth : "";
const model = payload.model; const model = payload.model;
@ -65,6 +65,8 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
? modelsPath ? modelsPath
: savedCustomModelsPath ?? modelsPath, : savedCustomModelsPath ?? modelsPath,
model, model,
scale,
customWidth,
gpuId, gpuId,
saveImageAs, saveImageAs,
tileSize, tileSize,
@ -171,7 +173,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
model, model,
gpuId, gpuId,
saveImageAs, saveImageAs,
scale: scale.toString(), scale,
customWidth, customWidth,
compression, compression,
tileSize, tileSize,

View File

@ -69,20 +69,26 @@ export const getDoubleUpscaleArguments = ({
fullfileName, fullfileName,
outFile, outFile,
modelsPath, modelsPath,
scale,
model, model,
gpuId, gpuId,
saveImageAs, saveImageAs,
customWidth,
tileSize, tileSize,
}: { }: {
inputDir: string; inputDir: string;
fullfileName: string; fullfileName: string;
outFile: string; outFile: string;
modelsPath: string; modelsPath: string;
scale: string;
model: string; model: string;
gpuId: string; gpuId: string;
saveImageAs: ImageFormat; saveImageAs: ImageFormat;
customWidth: string;
tileSize: number; tileSize: number;
}) => { }) => {
const modelScale = getModelScale(model);
let includeScale = modelScale !== scale && !customWidth;
return [ return [
// INPUT IMAGE // INPUT IMAGE
"-i", "-i",
@ -90,6 +96,9 @@ export const getDoubleUpscaleArguments = ({
// OUTPUT IMAGE // OUTPUT IMAGE
"-o", "-o",
outFile, outFile,
// OUTPUT SCALE
includeScale ? "-s" : "",
includeScale ? scale : "",
// MODELS PATH // MODELS PATH
"-m", "-m",
modelsPath, modelsPath,
@ -129,7 +138,7 @@ export const getDoubleUpscaleSecondPassArguments = ({
compression: string; compression: string;
tileSize: number; tileSize: number;
}) => { }) => {
const modelScale = (parseInt(getModelScale(model)) ** 2).toString(); const modelScale = getModelScale(model);
let includeScale = modelScale !== scale && !customWidth; let includeScale = modelScale !== scale && !customWidth;
return [ return [
// INPUT IMAGE // INPUT IMAGE