[fix] lower webp quality for size

This commit is contained in:
kwaroran
2023-12-15 06:40:10 +09:00
parent c7349350f7
commit 9cc1147904

View File

@@ -278,11 +278,11 @@ async function resizeAndConvert(imageData: Uint8Array): Promise<Buffer> {
context.drawImage(image, 0, 0, width, height);
// Try to convert to WebP
let base64 = canvas.toDataURL('image/webp', 90);
let base64 = canvas.toDataURL('image/webp', 75);
// If WebP is not supported, convert to JPEG
if (base64.indexOf('data:image/webp') != 0) {
base64 = canvas.toDataURL('image/jpeg', 90);
base64 = canvas.toDataURL('image/jpeg', 75);
}
// Convert it to Uint8Array