diff --git a/electron/commands/batch-upscayl.ts b/electron/commands/batch-upscayl.ts index ee2c94f..75a0155 100644 --- a/electron/commands/batch-upscayl.ts +++ b/electron/commands/batch-upscayl.ts @@ -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 { diff --git a/electron/commands/double-upscayl.ts b/electron/commands/double-upscayl.ts index 7c35eaf..4ec1dcc 100644 --- a/electron/commands/double-upscayl.ts +++ b/electron/commands/double-upscayl.ts @@ -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(); } diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.ts index d1ee96a..6b9ff93 100644 --- a/electron/commands/image-upscayl.ts +++ b/electron/commands/image-upscayl.ts @@ -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 ); } } diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.ts index 7d8eac9..c81e902 100644 --- a/electron/utils/convert-and-scale.ts +++ b/electron/utils/convert-and-scale.ts @@ -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: ", { - originalWidth: originalImage.width, - originalHeight: originalImage.height, - scale, - saveImageAs, - compressionPercentage: compression, - compressionLevel, - }); + 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, })