1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 01:10:52 +01:00
This commit is contained in:
Nayam Amarshe 2023-10-14 14:11:57 +05:30
parent 0ff2eb8224
commit 9a58f2d2aa
4 changed files with 19 additions and 13 deletions

View File

@ -147,7 +147,8 @@ const batchUpscayl = async (event, payload) => {
mainWindow &&
mainWindow.webContents.send(
COMMAND.UPSCAYL_ERROR,
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page."
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page.\n" +
error
);
}
} else {

View File

@ -173,7 +173,8 @@ const doubleUpscayl = async (event, payload) => {
mainWindow &&
mainWindow.webContents.send(
COMMAND.UPSCAYL_ERROR,
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page."
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page.\n" +
error
);
upscayl.kill();
}

View File

@ -164,12 +164,13 @@ const imageUpscayl = async (event, payload) => {
try {
await convertAndScale(
inputDir + slash + fullfileName,
isAlpha ? outFile + ".png" : outFile,
outFile,
outFile,
desiredScale,
saveImageAs,
onError
);
if (saveImageAs === "jpg") fs.unlinkSync(outFile);
mainWindow.setProgressBar(-1);
mainWindow.webContents.send(
COMMAND.UPSCAYL_DONE,
@ -186,7 +187,8 @@ const imageUpscayl = async (event, payload) => {
upscayl.kill();
mainWindow.webContents.send(
COMMAND.UPSCAYL_ERROR,
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page."
"Error processing (scaling and converting) the image. Please report this error on Upscayl GitHub Issues page.\n" +
error
);
}
}

View File

@ -40,18 +40,20 @@ const convertAndScale = async (
// Convert compression percentage (0-100) to compressionLevel (0-9)
const compressionLevel = Math.round((compression / 100) * 9);
logit("📐 Processing Image: ", {
logit(
"📐 Processing Image: ",
JSON.stringify({
originalWidth: originalImage.width,
originalHeight: originalImage.height,
scale,
saveImageAs,
compressionPercentage: compression,
compressionLevel,
});
})
);
const buffer = await newImage.toBuffer();
try {
logit("");
await sharp(buffer, {
limitInputPixels: false,
})