diff --git a/electron/utils/get-arguments.ts b/electron/utils/get-arguments.ts index 43a468c..687c078 100644 --- a/electron/utils/get-arguments.ts +++ b/electron/utils/get-arguments.ts @@ -74,7 +74,6 @@ export const getDoubleUpscaleArguments = ({ gpuId ? `-g ${gpuId}` : "", "-f", saveImageAs, - customWidth ? `-w ${customWidth}` : "", ]; }; diff --git a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx index 778dfb4..b71a754 100644 --- a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx +++ b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx @@ -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;