This commit is contained in:
Nayam Amarshe
2024-02-09 18:26:04 +05:30
parent 701b11875a
commit 54fc57f633
5 changed files with 27 additions and 13 deletions

View File

@@ -10,9 +10,8 @@ const convertAndScale = async (
processedImagePath: string,
scale: string,
saveImageAs: ImageFormat,
isAlpha: boolean,
) => {
if (!isAlpha && !customWidth && scale === "4" && compression === 0) {
if (!customWidth && scale === "4" && compression === 0) {
logit("Skipping compression for 4x scale and 0% compression");
return;
}
@@ -36,7 +35,6 @@ const convertAndScale = async (
if (!originalImage) {
throw new Error("Could not grab the original image!");
}
console.log("🚀 => originalImage:", originalImage);
// Convert compression percentage (0-100) to compressionLevel (0-9)
const compressionLevel = Math.round((compression / 100) * 9);
@@ -71,8 +69,6 @@ const convertAndScale = async (
orientation: originalImage.orientation,
});
console.log("🚀 => newImage:", newImage);
const buffer = await newImage
.withMetadata({
density: originalImage.density,

View File

@@ -6,6 +6,9 @@ const logit = (...args: any) => {
const mainWindow = getMainWindow();
if (!mainWindow) return;
log.log(...args);
if (process.env.NODE_ENV === "development") {
return;
}
mainWindow.webContents.send(COMMAND.LOG, args.join(" "));
};