diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 5edec79bb8..28ddbb32eb 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -348,7 +348,8 @@ export const compressImage = async (imageUrl, maxWidth, maxHeight) => { context.drawImage(img, 0, 0, width, height); // Get compressed image URL - const compressedUrl = canvas.toDataURL(); + const mimeType = imageUrl.match(/^data:([^;]+);/)?.[1]; + const compressedUrl = canvas.toDataURL(mimeType); resolve(compressedUrl); }; img.onerror = (error) => reject(error);