mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-21 13:09:35 +01:00
Fix options
This commit is contained in:
parent
4d996dc380
commit
8d34704d38
@ -2,6 +2,7 @@ import fs from "fs";
|
|||||||
import { modelsPath } from "../utils/get-resource-paths";
|
import { modelsPath } from "../utils/get-resource-paths";
|
||||||
import COMMAND from "../constants/commands";
|
import COMMAND from "../constants/commands";
|
||||||
import {
|
import {
|
||||||
|
compression,
|
||||||
customModelsFolderPath,
|
customModelsFolderPath,
|
||||||
folderPath,
|
folderPath,
|
||||||
outputFolderPath,
|
outputFolderPath,
|
||||||
@ -133,14 +134,16 @@ const imageUpscayl = async (event, payload) => {
|
|||||||
// Free up memory
|
// Free up memory
|
||||||
upscayl.kill();
|
upscayl.kill();
|
||||||
try {
|
try {
|
||||||
await convertAndScale(
|
if (saveImageAs !== "png" && scale !== "4" && compression !== 0) {
|
||||||
inputDir + slash + fullfileName,
|
await convertAndScale(
|
||||||
isAlpha ? outFile + ".png" : outFile,
|
inputDir + slash + fullfileName,
|
||||||
outFile,
|
isAlpha ? outFile + ".png" : outFile,
|
||||||
payload.scale,
|
outFile,
|
||||||
saveImageAs,
|
payload.scale,
|
||||||
onError
|
saveImageAs,
|
||||||
);
|
onError
|
||||||
|
);
|
||||||
|
}
|
||||||
mainWindow.setProgressBar(-1);
|
mainWindow.setProgressBar(-1);
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
COMMAND.UPSCAYL_DONE,
|
COMMAND.UPSCAYL_DONE,
|
||||||
|
@ -36,8 +36,14 @@ const convertAndScale = async (
|
|||||||
limitInputPixels: false,
|
limitInputPixels: false,
|
||||||
})
|
})
|
||||||
.toFormat(saveImageAs as keyof FormatEnum, {
|
.toFormat(saveImageAs as keyof FormatEnum, {
|
||||||
quality: 100 - (compression === 100 ? 99 : compression),
|
...(saveImageAs === "jpg" && {
|
||||||
compressionLevel,
|
quality: 100 - (compression === 100 ? 99 : compression),
|
||||||
|
chromaSubsampling: "4:4:4",
|
||||||
|
}),
|
||||||
|
...(saveImageAs === "png" && {
|
||||||
|
compressionLevel,
|
||||||
|
}),
|
||||||
|
force: true,
|
||||||
})
|
})
|
||||||
.withMetadata({
|
.withMetadata({
|
||||||
orientation: originalImage.orientation,
|
orientation: originalImage.orientation,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user