π Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.
TypeScript aielectronesrgangigapixelgigapixel-imagesimageimage-upscalingtopazupscaleupscalerimageupscayl
Fix color profile
Nayam Amarshe34db484936f7
diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.tsindex 15b4335..4c10a66 100644--- a/electron/utils/convert-and-scale.ts+++ b/electron/utils/convert-and-scale.ts@@ -14,18 +14,17 @@ const convertAndScale = async (const mainWindow = getMainWindow();const originalImage = await sharp(originalImagePath).metadata();+if (!mainWindow || !originalImage) {throw new Error("Could not grab the original image!");}// Resize the image to the scaleconst newImage = sharp(upscaledImagePath, {limitInputPixels: false,- })- .resize(- originalImage.width && originalImage.width * parseInt(scale),- originalImage.height && originalImage.height * parseInt(scale)- )- .withMetadata(); // Keep metadata+ }).resize(+ originalImage.width && originalImage.width * parseInt(scale),+ originalImage.height && originalImage.height * parseInt(scale)+ );// Convert compression percentage (0-100) to compressionLevel (0-9)const compressionLevel = Math.round((compression / 100) * 9);@@ -36,14 +35,20 @@ const convertAndScale = async (console.log("compression: ", compression);newImage.jpeg({quality: 100 - (compression === 100 ? 99 : compression),+ chromaSubsampling: "4:4:4",});}- // Save the image+const buffer = await newImage.toBuffer();try {await sharp(buffer, {limitInputPixels: false,- }).toFile(processedImagePath);+ })+ .withMetadata({+ orientation: originalImage.orientation,+ density: originalImage.density,+ })+ .toFile(processedImagePath);} catch (error) {logit("β Error converting to: ", saveImageAs, error);onError(error);diff --git a/package-lock.json b/package-lock.jsonindex 4898614..0704579 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,6 +1,6 @@{"name": "upscayl",- "version": "2.8.5",+ "version": "2.8.1","lockfileVersion": 2,"requires": true,"packages": {