1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-12 17:04:34 +01:00
upscayl/electron/utils/getArguments.ts

167 lines
2.6 KiB
TypeScript
Raw Normal View History

2023-04-28 20:18:19 -04:00
import getPlatform from "../getPlatform";
const slash: string = getPlatform() === "win" ? "\\" : "/";
2023-03-18 17:45:48 +05:30
export const getSingleImageArguments = (
inputDir: string,
fullfileName: string,
outFile: string,
modelsPath: string,
model: string,
scale: any,
gpuId: string,
saveImageAs: string
2023-03-18 17:28:38 +05:30
) => {
2023-03-18 17:45:48 +05:30
return [
"-i",
2023-04-28 20:18:19 -04:00
inputDir + slash + fullfileName,
2023-03-18 17:45:48 +05:30
"-o",
outFile,
"-s",
2023-04-14 16:01:37 +05:30
scale,
2023-03-18 17:45:48 +05:30
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
saveImageAs,
];
};
export const getSingleImageSharpenArguments = (
inputDir: string,
fullfileName: string,
outFile: string,
modelsPath: string,
model: string,
scale: any,
gpuId: string,
saveImageAs: string
) => {
return [
"-i",
2023-04-28 20:18:19 -04:00
inputDir + slash + fullfileName,
2023-03-18 17:45:48 +05:30
"-o",
outFile,
"-s",
scale,
"-x",
"-m",
2023-04-28 20:18:19 -04:00
modelsPath + slash + model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
saveImageAs,
];
};
export const getDoubleUpscaleArguments = (
inputDir: string,
fullfileName: string,
outFile: string,
modelsPath: string,
model: string,
gpuId: string,
2023-04-14 16:01:37 +05:30
saveImageAs: string,
scale: string
2023-03-18 17:45:48 +05:30
) => {
return [
"-i",
2023-04-28 20:18:19 -04:00
inputDir + slash + fullfileName,
2023-03-18 17:45:48 +05:30
"-o",
outFile,
"-s",
2023-04-14 16:01:37 +05:30
scale,
2023-03-18 17:45:48 +05:30
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
saveImageAs,
];
};
export const getDoubleUpscaleSecondPassArguments = (
isAlpha: boolean,
outFile: string,
modelsPath: string,
model: string,
gpuId: string,
2023-04-14 16:01:37 +05:30
saveImageAs: string,
scale: string
2023-03-18 17:45:48 +05:30
) => {
return [
"-i",
isAlpha ? outFile + ".png" : outFile,
"-o",
isAlpha ? outFile + ".png" : outFile,
"-s",
2023-04-14 16:01:37 +05:30
scale,
2023-03-18 17:45:48 +05:30
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
isAlpha ? "" : saveImageAs,
];
};
export const getBatchArguments = (
inputDir: string,
outputDir: string,
modelsPath: string,
model: string,
gpuId: string,
2023-04-14 16:01:37 +05:30
saveImageAs: string,
scale: string
2023-03-18 17:45:48 +05:30
) => {
return [
"-i",
inputDir,
"-o",
outputDir,
"-s",
2023-04-14 16:01:37 +05:30
scale,
2023-03-18 17:45:48 +05:30
"-m",
modelsPath,
"-n",
model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
saveImageAs,
];
};
2023-04-14 16:01:37 +05:30
// ! REDUNDANT
2023-03-18 17:45:48 +05:30
export const getBatchSharpenArguments = (
inputDir: string,
outputDir: string,
modelsPath: string,
model: string,
gpuId: string,
2023-04-14 16:01:37 +05:30
saveImageAs: string,
scale: string
2023-03-18 17:45:48 +05:30
) => {
return [
"-i",
inputDir,
"-o",
outputDir,
"-s",
2023-04-14 16:01:37 +05:30
scale,
2023-03-18 17:45:48 +05:30
"-x",
"-m",
2023-04-28 20:18:19 -04:00
modelsPath + slash + model,
gpuId ? "-g" : "",
gpuId ? gpuId : "",
2023-03-18 17:45:48 +05:30
"-f",
saveImageAs,
];
2023-03-18 17:28:38 +05:30
};