mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
don't recompress animated images, #1585
This commit is contained in:
@@ -11,6 +11,7 @@ const imageType = require('image-type');
|
||||
const sanitizeFilename = require('sanitize-filename');
|
||||
const noteRevisionService = require('./note_revisions.js');
|
||||
const isSvg = require('is-svg');
|
||||
const isAnimated = require('is-animated');
|
||||
|
||||
async function processImage(uploadBuffer, originalName, shrinkImageSwitch) {
|
||||
const origImageFormat = getImageType(uploadBuffer);
|
||||
@@ -19,6 +20,10 @@ async function processImage(uploadBuffer, originalName, shrinkImageSwitch) {
|
||||
// JIMP does not support webp at the moment: https://github.com/oliver-moran/jimp/issues/144
|
||||
shrinkImageSwitch = false;
|
||||
}
|
||||
else if (isAnimated(uploadBuffer)) {
|
||||
// recompression of animated images will make them static
|
||||
shrinkImageSwitch = false;
|
||||
}
|
||||
|
||||
const finalImageBuffer = shrinkImageSwitch ? await shrinkImage(uploadBuffer, originalName) : uploadBuffer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user