1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 09:20:52 +01:00
upscayl/electron/utils/get-arguments.ts

148 lines
2.3 KiB
TypeScript
Raw Normal View History

2023-09-10 20:00:49 +02:00
import { getPlatform } from "./get-device-specs";
import { ImageFormat } from "./types";
2023-04-29 02:18:19 +02:00
const slash: string = getPlatform() === "win" ? "\\" : "/";
2024-04-09 20:11:24 +02:00
export const getSingleImageArguments = ({
inputDir,
fullfileName,
outFile,
modelsPath,
model,
scale,
gpuId,
saveImageAs,
}: {
inputDir: string;
fullfileName: string;
outFile: string;
modelsPath: string;
model: string;
scale: any;
gpuId: string;
saveImageAs: ImageFormat;
}) => {
2023-03-18 13:15:48 +01:00
return [
"-i",
2023-04-29 02:18:19 +02:00
inputDir + slash + fullfileName,
2023-03-18 13:15:48 +01:00
"-o",
outFile,
"-s",
2023-04-14 12:31:37 +02:00
scale,
2023-03-18 13:15:48 +01:00
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 13:15:48 +01:00
"-f",
saveImageAs,
];
};
2024-04-09 20:11:24 +02:00
export const getDoubleUpscaleArguments = ({
inputDir,
fullfileName,
outFile,
modelsPath,
model,
gpuId,
saveImageAs,
scale,
}: {
inputDir: string;
fullfileName: string;
outFile: string;
modelsPath: string;
model: string;
gpuId: string;
saveImageAs: ImageFormat;
scale: string;
}) => {
2023-03-18 13:15:48 +01:00
return [
"-i",
2023-04-29 02:18:19 +02:00
inputDir + slash + fullfileName,
2023-03-18 13:15:48 +01:00
"-o",
outFile,
"-s",
2023-04-14 12:31:37 +02:00
scale,
2023-03-18 13:15:48 +01:00
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 13:15:48 +01:00
"-f",
saveImageAs,
];
};
2024-04-09 20:11:24 +02:00
export const getDoubleUpscaleSecondPassArguments = ({
isAlpha,
outFile,
modelsPath,
model,
gpuId,
saveImageAs,
scale,
}: {
isAlpha: boolean;
outFile: string;
modelsPath: string;
model: string;
gpuId: string;
saveImageAs: ImageFormat;
scale: string;
}) => {
2023-03-18 13:15:48 +01:00
return [
"-i",
isAlpha ? outFile + ".png" : outFile,
"-o",
isAlpha ? outFile + ".png" : outFile,
"-s",
2023-04-14 12:31:37 +02:00
scale,
2023-03-18 13:15:48 +01:00
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2024-02-14 07:00:39 +01:00
isAlpha ? "" : "-f",
2023-03-18 13:15:48 +01:00
isAlpha ? "" : saveImageAs,
];
};
2024-04-09 20:11:24 +02:00
export const getBatchArguments = ({
inputDir,
outputDir,
modelsPath,
model,
gpuId,
saveImageAs,
scale,
}: {
inputDir: string;
outputDir: string;
modelsPath: string;
model: string;
gpuId: string;
saveImageAs: ImageFormat;
scale: string;
}) => {
2023-03-18 13:15:48 +01:00
return [
"-i",
inputDir,
"-o",
outputDir,
"-s",
2023-04-14 12:31:37 +02:00
scale,
2023-03-18 13:15:48 +01:00
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 13:15:48 +01:00
"-f",
saveImageAs,
];
2023-03-18 13:15:48 +01:00
};