Improved size of animated images

This commit is contained in:
SG-O 2022-07-08 05:07:36 +02:00
parent d89bfd2f22
commit 87cecc9540

View File

@ -141,13 +141,13 @@ class _MatrixStickerBot {
thumbUpload = imageUpload; thumbUpload = imageUpload;
} }
if (mime === "image/gif" || mime === "image/webp" || mime === "image/avif-sequence") { if (mime === "image/gif" || mime === "image/webp" || mime === "image/avif-sequence") {
imageUpload = await resizedImage.webp({nearLossless: true, quality: 60}).toBuffer(); imageUpload = await resizedImage.webp({quality: 60, effort: 6}).toBuffer();
thumbUpload = await sharp(downImage, {animated: false}).resize({ thumbUpload = await sharp(downImage, {animated: false}).resize({
width: size, width: size,
height: size, height: size,
fit: 'contain', fit: 'contain',
background: 'rgba(0,0,0,0)', background: 'rgba(0,0,0,0)',
}).webp({quality: 60}).toBuffer(); }).webp({quality: 50}).toBuffer();
mime = "image/webp"; mime = "image/webp";
} }
if (mime === "image/avif") { if (mime === "image/avif") {