Skip to content

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

Refactor image saving format in batch-upscayl.ts and get-arguments.ts

Nayam Amarshea80f85a069bd
diff --git a/electron/commands/batch-upscayl.ts b/electron/commands/batch-upscayl.ts
index 628dd9a..8a748f3 100644
--- a/electron/commands/batch-upscayl.ts
+++ b/electron/commands/batch-upscayl.ts
@@ -74,7 +74,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
isDefaultModel ? modelsPath : customModelsFolderPath ?? modelsPath,
model,
gpuId,
- "png",
+ saveImageAs,
initialScale
),
logit
@@ -138,7 +138,9 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
console.log("Filename: ", removeFileExtension(file));
await convertAndScale(
inputDir + slash + file,
- `${outputFolderPath}${slash}${removeFileExtension(file)}.png`,
+ `${outputFolderPath}${slash}${removeFileExtension(
+ file
+ )}.${saveImageAs}`,
`${outputFolderPath}/${removeFileExtension(file)}.${saveImageAs}`,
desiredScale,
saveImageAs,
diff --git a/electron/utils/get-arguments.ts b/electron/utils/get-arguments.ts
index a385ab3..0f90c6a 100644
--- a/electron/utils/get-arguments.ts
+++ b/electron/utils/get-arguments.ts
@@ -1,4 +1,5 @@
import { getPlatform } from "./get-device-specs";
+import { ImageFormat } from "./types";
const slash: string = getPlatform() === "win" ? "\\" : "/";
export const getSingleImageArguments = (
@@ -9,7 +10,7 @@ export const getSingleImageArguments = (
model: string,
scale: any,
gpuId: string,
- saveImageAs: string
+ saveImageAs: ImageFormat
) => {
return [
"-i",
@@ -37,7 +38,7 @@ export const getSingleImageSharpenArguments = (
model: string,
scale: any,
gpuId: string,
- saveImageAs: string
+ saveImageAs: ImageFormat
) => {
return [
"-i",
@@ -63,7 +64,7 @@ export const getDoubleUpscaleArguments = (
modelsPath: string,
model: string,
gpuId: string,
- saveImageAs: string,
+ saveImageAs: ImageFormat,
scale: string
) => {
return [
@@ -90,7 +91,7 @@ export const getDoubleUpscaleSecondPassArguments = (
modelsPath: string,
model: string,
gpuId: string,
- saveImageAs: string,
+ saveImageAs: ImageFormat,
scale: string
) => {
return [
@@ -117,7 +118,7 @@ export const getBatchArguments = (
modelsPath: string,
model: string,
gpuId: string,
- saveImageAs: string,
+ saveImageAs: ImageFormat,
scale: string
) => {
return [