Skip to content

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

Fix batch mode JPG Alpha, Rename Fast model & Fix tooltip z-index

Nayam Amarshe801755ca9f21
diff --git a/common/models-list.ts b/common/models-list.ts
index 96ce947..dc1a8f9 100644
--- a/common/models-list.ts
+++ b/common/models-list.ts
@@ -2,7 +2,7 @@ export const defaultModelsList = [
{ label: "General Photo (Real-ESRGAN)", value: "realesrgan-x4plus" },
{
label: "General Photo (Fast Real-ESRGAN)",
- value: "RealESRGAN_General_x4_v3",
+ value: "realesrgan-x4fast",
},
{ label: "General Photo (Remacri)", value: "remacri" },
{ label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" },
diff --git a/electron/commands/batch-upscayl.ts b/electron/commands/batch-upscayl.ts
index f1cf2a1..64e5880 100644
--- a/electron/commands/batch-upscayl.ts
+++ b/electron/commands/batch-upscayl.ts
@@ -53,7 +53,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
? customWidth || payload.scale
: payload.scale;
- const outputFolderName = `upscayl_${model}_${noImageProcessing ? initialScale : desiredScale}${useCustomWidth ? "px_" : "x_"}`;
+ const outputFolderName = `upscayl_${saveImageAs}_${model}_${noImageProcessing ? initialScale : desiredScale}${useCustomWidth ? "px" : "x"}`;
outputFolderPath += slash + outputFolderName;
if (!fs.existsSync(outputFolderPath)) {
fs.mkdirSync(outputFolderPath, { recursive: true });
@@ -148,6 +148,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
let upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(
file,
)}.${saveImageAs}`;
+ let imageIsAlpha = false;
if (
isAlpha &&
saveImageAs === "jpg" &&
@@ -155,6 +156,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
)
) {
+ imageIsAlpha = true;
console.log("This is an Alpha image!");
upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`;
}
@@ -166,6 +168,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
)}.${saveImageAs}`,
desiredScale,
saveImageAs,
+ imageIsAlpha,
);
if (
isAlpha &&
diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.ts
index 65fdf67..2d974ae 100644
--- a/electron/utils/convert-and-scale.ts
+++ b/electron/utils/convert-and-scale.ts
@@ -10,11 +10,30 @@ const convertAndScale = async (
processedImagePath: string,
scale: string,
saveImageAs: ImageFormat,
+ imageIsAlpha?: boolean,
) => {
- if (!customWidth && scale === "4" && compression === 0) {
+ // Skip conversion when the scale is 4x and compression is 0
+ // - When output format is WebP or PNG
+ // - When the image is not alpha and the output format is JPEG
+ if (
+ !customWidth &&
+ (saveImageAs === "png" || saveImageAs === "webp") &&
+ scale === "4" &&
+ compression === 0
+ ) {
+ logit("Skipping compression for 4x scale and 0% compression");
+ return;
+ } else if (
+ !customWidth &&
+ saveImageAs === "jpg" &&
+ scale === "4" &&
+ compression === 0 &&
+ !imageIsAlpha
+ ) {
logit("Skipping compression for 4x scale and 0% compression");
return;
}
+
let originalImage: Metadata | undefined;
try {
diff --git a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx
index 6a0e8f2..1ea732f 100644
--- a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx
+++ b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx
@@ -311,7 +311,7 @@ function LeftPaneImageSteps({
</button>
</div>
- <Tooltip className="max-w-sm" id="tooltip" />
+ <Tooltip className="z-50 max-w-sm" id="tooltip" />
</div>
);
}
diff --git a/resources/models/RealESRGAN_General_x4_v3.bin b/resources/models/realesrgan-x4fast.bin
similarity index 100%
rename from resources/models/RealESRGAN_General_x4_v3.bin
rename to resources/models/realesrgan-x4fast.bin
diff --git a/resources/models/RealESRGAN_General_x4_v3.param b/resources/models/realesrgan-x4fast.param
similarity index 100%
rename from resources/models/RealESRGAN_General_x4_v3.param
rename to resources/models/realesrgan-x4fast.param