Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Set fill to white bg for transparent images

Luke Vella4e6224bf21eb
diff --git a/apps/web/src/lib/image-processing.ts b/apps/web/src/lib/image-processing.ts
index 536b4850c..1bf00e8a2 100644
--- a/apps/web/src/lib/image-processing.ts
+++ b/apps/web/src/lib/image-processing.ts
@@ -69,6 +69,12 @@ export function getCroppedImg(
ctx.imageSmoothingEnabled = true;
ctx.imageSmoothingQuality = "high";
+ // Fill canvas with white background for PNGs with transparency
+ if (fileType === "image/png") {
+ ctx.fillStyle = "#ffffff";
+ ctx.fillRect(0, 0, outputWidth, outputHeight);
+ }
+
// Draw the cropped and resized image
ctx.drawImage(
image,