1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-17 11:18:36 +01:00

Fix resolution logic

This commit is contained in:
Nayam Amarshe 2024-04-21 23:03:02 +05:30
parent bc63f8533e
commit d095ded3ff
2 changed files with 20 additions and 10 deletions

View File

@ -74,7 +74,6 @@ export const getDoubleUpscaleArguments = ({
gpuId ? `-g ${gpuId}` : "",
"-f",
saveImageAs,
customWidth ? `-w ${customWidth}` : "",
];
};

View File

@ -148,17 +148,28 @@ function LeftPaneImageSteps({
let doubleScale = parseInt(scale) * parseInt(scale);
let singleScale = parseInt(scale);
if (useCustomWidth) {
}
if (doubleUpscayl) {
const newWidth = dimensions.width * doubleScale;
const newHeight = dimensions.height * doubleScale;
newDimensions.width = newWidth;
newDimensions.height = newHeight;
if (useCustomWidth) {
newDimensions.width = customWidth;
newDimensions.height = Math.round(
customWidth * (dimensions.height / dimensions.width),
);
} else {
const newWidth = dimensions.width * doubleScale;
const newHeight = dimensions.height * doubleScale;
newDimensions.width = newWidth;
newDimensions.height = newHeight;
}
} else {
newDimensions.width = dimensions.width * singleScale;
newDimensions.height = dimensions.height * singleScale;
if (useCustomWidth) {
newDimensions.width = customWidth;
newDimensions.height = Math.round(
customWidth * (dimensions.height / dimensions.width),
);
} else {
newDimensions.width = dimensions.width * singleScale;
newDimensions.height = dimensions.height * singleScale;
}
}
return newDimensions;