mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-12 01:40:53 +01:00
Fix #787
This commit is contained in:
parent
1e96386776
commit
6f8df14ed9
@ -3,7 +3,6 @@ import { getMainWindow } from "../main-window";
|
||||
import {
|
||||
childProcesses,
|
||||
savedCustomModelsPath,
|
||||
noImageProcessing,
|
||||
rememberOutputFolder,
|
||||
setCompression,
|
||||
setNoImageProcessing,
|
||||
@ -17,7 +16,7 @@ import slash from "../utils/slash";
|
||||
import { modelsPath } from "../utils/get-resource-paths";
|
||||
import COMMAND from "../../common/commands";
|
||||
import { BatchUpscaylPayload } from "../../common/types/types";
|
||||
import { ImageFormat } from "../utils/types";
|
||||
import { ImageFormat } from "../types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS } from "../../common/models-list";
|
||||
|
||||
|
@ -3,7 +3,6 @@ import { getMainWindow } from "../main-window";
|
||||
import {
|
||||
childProcesses,
|
||||
savedCustomModelsPath,
|
||||
noImageProcessing,
|
||||
savedOutputPath,
|
||||
rememberOutputFolder,
|
||||
setCompression,
|
||||
@ -21,7 +20,7 @@ import { modelsPath } from "../utils/get-resource-paths";
|
||||
import logit from "../utils/logit";
|
||||
import COMMAND from "../../common/commands";
|
||||
import { DoubleUpscaylPayload } from "../../common/types/types";
|
||||
import { ImageFormat } from "../utils/types";
|
||||
import { ImageFormat } from "../types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS } from "../../common/models-list";
|
||||
|
||||
@ -76,8 +75,6 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
|
||||
model,
|
||||
gpuId,
|
||||
saveImageAs,
|
||||
scale: scale.toString(),
|
||||
customWidth,
|
||||
}),
|
||||
logit,
|
||||
);
|
||||
|
@ -5,7 +5,6 @@ import {
|
||||
savedCompression,
|
||||
savedCustomModelsPath,
|
||||
savedBatchUpscaylFolderPath,
|
||||
noImageProcessing,
|
||||
savedOutputPath,
|
||||
rememberOutputFolder,
|
||||
setChildProcesses,
|
||||
@ -21,8 +20,7 @@ import { spawnUpscayl } from "../utils/spawn-upscayl";
|
||||
import { parse } from "path";
|
||||
import { getMainWindow } from "../main-window";
|
||||
import { ImageUpscaylPayload } from "../../common/types/types";
|
||||
import { ImageFormat } from "../utils/types";
|
||||
import getModelScale from "../../common/check-model-scale";
|
||||
import { ImageFormat } from "../types/types";
|
||||
import showNotification from "../utils/show-notification";
|
||||
import { DEFAULT_MODELS } from "../../common/models-list";
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import getModelScale from "@common/check-model-scale";
|
||||
import { getPlatform } from "./get-device-specs";
|
||||
import { ImageFormat } from "./types";
|
||||
import { ImageFormat } from "../types/types";
|
||||
const slash: string = getPlatform() === "win" ? "\\" : "/";
|
||||
|
||||
export const getSingleImageArguments = ({
|
||||
@ -18,25 +19,38 @@ export const getSingleImageArguments = ({
|
||||
outFile: string;
|
||||
modelsPath: string;
|
||||
model: string;
|
||||
scale: any;
|
||||
scale: string;
|
||||
gpuId: string;
|
||||
saveImageAs: ImageFormat;
|
||||
customWidth: string;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
return [
|
||||
// INPUT IMAGE
|
||||
"-i",
|
||||
inputDir + slash + fullfileName,
|
||||
// OUTPUT IMAGE
|
||||
"-o",
|
||||
outFile,
|
||||
customWidth ? "" : `-s ${scale}`,
|
||||
// OUTPUT SCALE
|
||||
includeScale ? "-s" : "",
|
||||
includeScale ? scale : "",
|
||||
// MODELS PATH
|
||||
"-m",
|
||||
modelsPath,
|
||||
// MODEL NAME
|
||||
"-n",
|
||||
model,
|
||||
gpuId ? `-g ${gpuId}` : "",
|
||||
// GPU ID
|
||||
gpuId ? "-g" : "",
|
||||
gpuId ? gpuId : "",
|
||||
// FORMAT
|
||||
"-f",
|
||||
saveImageAs,
|
||||
customWidth ? `-w ${customWidth}` : "",
|
||||
// CUSTOM WIDTH
|
||||
customWidth ? `-w` : "",
|
||||
customWidth ? customWidth : "",
|
||||
];
|
||||
};
|
||||
|
||||
@ -48,8 +62,6 @@ export const getDoubleUpscaleArguments = ({
|
||||
model,
|
||||
gpuId,
|
||||
saveImageAs,
|
||||
scale,
|
||||
customWidth,
|
||||
}: {
|
||||
inputDir: string;
|
||||
fullfileName: string;
|
||||
@ -58,20 +70,24 @@ export const getDoubleUpscaleArguments = ({
|
||||
model: string;
|
||||
gpuId: string;
|
||||
saveImageAs: ImageFormat;
|
||||
scale: string;
|
||||
customWidth: string;
|
||||
}) => {
|
||||
return [
|
||||
// INPUT IMAGE
|
||||
"-i",
|
||||
inputDir + slash + fullfileName,
|
||||
// OUTPUT IMAGE
|
||||
"-o",
|
||||
outFile,
|
||||
customWidth ? "" : `-s ${scale}`,
|
||||
// MODELS PATH
|
||||
"-m",
|
||||
modelsPath,
|
||||
// MODEL NAME
|
||||
"-n",
|
||||
model,
|
||||
gpuId ? `-g ${gpuId}` : "",
|
||||
// GPU ID
|
||||
gpuId ? `-g` : "",
|
||||
gpuId ? gpuId : "",
|
||||
// FORMAT
|
||||
"-f",
|
||||
saveImageAs,
|
||||
];
|
||||
@ -94,21 +110,33 @@ export const getDoubleUpscaleSecondPassArguments = ({
|
||||
scale: string;
|
||||
customWidth: string;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
return [
|
||||
// INPUT IMAGE
|
||||
"-i",
|
||||
outFile,
|
||||
// OUTPUT IMAGE
|
||||
"-o",
|
||||
outFile,
|
||||
"-s",
|
||||
customWidth ? "" : `-s ${scale}`,
|
||||
// OUTPUT SCALE
|
||||
includeScale ? "-s" : "",
|
||||
includeScale ? scale : "",
|
||||
// MODELS PATH
|
||||
"-m",
|
||||
modelsPath,
|
||||
// MODEL NAME
|
||||
"-n",
|
||||
model,
|
||||
gpuId ? `-g ${gpuId}` : "",
|
||||
// GPU ID
|
||||
gpuId ? `-g` : "",
|
||||
gpuId ? gpuId : "",
|
||||
// FORMAT
|
||||
"-f",
|
||||
saveImageAs,
|
||||
customWidth ? `-w ${customWidth}` : "",
|
||||
// CUSTOM WIDTH
|
||||
customWidth ? `-w` : "",
|
||||
customWidth ? customWidth : "",
|
||||
];
|
||||
};
|
||||
|
||||
@ -131,19 +159,33 @@ export const getBatchArguments = ({
|
||||
scale: string;
|
||||
customWidth: string;
|
||||
}) => {
|
||||
const modelScale = getModelScale(model);
|
||||
let includeScale = modelScale !== scale && !customWidth;
|
||||
|
||||
return [
|
||||
// INPUT IMAGE
|
||||
"-i",
|
||||
inputDir,
|
||||
// OUTPUT IMAGE
|
||||
"-o",
|
||||
outputDir,
|
||||
customWidth ? "" : `-s ${scale}`,
|
||||
// OUTPUT SCALE
|
||||
includeScale ? "-s" : "",
|
||||
includeScale ? scale : "",
|
||||
// MODELS PATH
|
||||
"-m",
|
||||
modelsPath,
|
||||
// MODEL NAME
|
||||
"-n",
|
||||
model,
|
||||
gpuId ? `-g ${gpuId}` : "",
|
||||
// GPU ID
|
||||
gpuId ? `-g` : "",
|
||||
gpuId ? gpuId : "",
|
||||
// FORMAT
|
||||
"-f",
|
||||
saveImageAs,
|
||||
customWidth ? `-w ${customWidth}` : "",
|
||||
// CUSTOM WIDTH
|
||||
customWidth ? `-w` : "",
|
||||
customWidth ? customWidth : "",
|
||||
];
|
||||
};
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { Dirent } from "fs";
|
||||
|
||||
/**
|
||||
* Returns the filename without the extension.
|
||||
* @param filename The filename to remove the extension from.
|
||||
|
Loading…
Reference in New Issue
Block a user