1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-24 07:30:19 +01:00

Fix scaling

This commit is contained in:
Nayam Amarshe 2023-09-09 18:31:31 +05:30
parent 883171a99f
commit 2def61e194
2 changed files with 7 additions and 5 deletions

View File

@ -255,7 +255,7 @@ const convertAndScale = async (
.withMetadata(); // Keep metadata .withMetadata(); // Keep metadata
// Change the output according to the saveImageAs // Change the output according to the saveImageAs
if (saveImageAs === "png") { if (saveImageAs === "png") {
newImage.png({ compressionLevel: quality }); newImage.png({ quality: 100 - quality });
} else if (saveImageAs === "jpg") { } else if (saveImageAs === "jpg") {
console.log("Quality: ", quality); console.log("Quality: ", quality);
newImage.jpeg({ quality: 100 - quality }); newImage.jpeg({ quality: 100 - quality });
@ -555,7 +555,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
} }
}); });
//------------------------Folder Upscayl-----------------------------// //------------------------Batch Upscayl-----------------------------//
ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => { ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => {
if (!mainWindow) return; if (!mainWindow) return;
// GET THE MODEL // GET THE MODEL
@ -656,7 +656,7 @@ ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => {
await convertAndScale( await convertAndScale(
inputDir + slash + file, inputDir + slash + file,
outputDir + slash + file.slice(0, -3) + "png", outputDir + slash + file.slice(0, -3) + "png",
outputDir + slash + file, outputDir + slash + file.slice(0, -3) + saveImageAs,
payload.scale, payload.scale,
saveImageAs, saveImageAs,
onError onError

View File

@ -399,6 +399,7 @@ const Home = () => {
const upscaylHandler = async () => { const upscaylHandler = async () => {
logit("🔄 Resetting Upscaled Image Path"); logit("🔄 Resetting Upscaled Image Path");
setUpscaledImagePath(""); setUpscaledImagePath("");
setUpscaledBatchFolderPath("");
if (imagePath !== "" || batchFolderPath !== "") { if (imagePath !== "" || batchFolderPath !== "") {
setProgress("Hold on..."); setProgress("Hold on...");
@ -620,8 +621,9 @@ const Home = () => {
{batchMode && {batchMode &&
upscaledBatchFolderPath.length === 0 && upscaledBatchFolderPath.length === 0 &&
batchFolderPath.length > 0 && ( batchFolderPath.length > 0 && (
<p className="select-none font-bold text-neutral-50"> <p className="select-none text-neutral-50">
Selected folder: {batchFolderPath} <span className="font-bold">Selected folder:</span>{" "}
{batchFolderPath}
</p> </p>
)} )}