|Open||Feature||None||T290345 Create thumbnail for animated WebP files|
|Open||None||T216815 Upgrade Thumbor to Buster|
|Open||None||T212941 Investigate systemd hardening to replace Firejail for Thumbor|
|Resolved||fgiunchedi||T212946 Stream Thumbor logs to logstash|
|Resolved||• Gilles||T187765 Replace the Nginx fronting Thumbor with Haproxy|
|Resolved||fgiunchedi||T204266 Backport prometheus haproxy exporter for Jessie|
|Resolved||jijiki||T220499 Export useful metrics from haproxy logs for Thumbor|
|Resolved||None||T216892 Santali font shown as square boxes in thumbnail version of a specific SVG file|
|Resolved||jijiki||T221562 Build Thumbor packages for buster|
We have four options:
- Treat them like media: thumbnail to a static png/webp, and make TimedMediaHandler deal with the rest of it. That would mean no looping & no inline autoplay.
- Treat them like animated SVGs: thumbnail to a static png/webp and forget about the animation.
- Treat them like GIF: thumbnail to a gif, potentially serving awebp if the client supports it (currently not done T290351)
- Thumbnail to awebp only, clients not supporting it get nothing.
Notwithstanding the various tasks to treat GIF as timed media (which have been collecting dust for years), #3 or #4 are probably the best options. #3 would mean usually thumbnailing to a worse format, but #4 would depend on browser support (at least in Grade A but preferably also Grade C as well). There is also a sort of option 3.5 of serving awebp unless the client doesn't support it, then falling back to gif or png. We don't quite do that for any other file though, so it could require more work to implement.
Currently we use gifsicle to thumbnail gifs, which only supports reading and writing gifs. We use cwebp for writing webps, which doesn't support animated webp. However, webpmux, which is packaged alongside cwebp, can work with animated webp.
I tried resizing an animated webp with imagemagick on my laptop, and it did work. However, I'm running a considerably newer version compared to production Thumbor.
$ convert -version Version: ImageMagick 7.1.0-5 Q16 x86_64 2021-08-22 https://imagemagick.org Copyright: (C) 1999-2021 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(4.5) Delegates (built-in): bzlib cairo djvu fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raqm raw rsvg tiff webp wmf x xml zip zlib $ cwebp -version 1.2.1
With ImageMagick 6.9.7-4, it just tries to use cwebp to open the animated image and fails.
$ convert --resize 220x file.webp 220px-file.webp Error! Decoding of an animated WebP file is not supported. Use webpmux to extract the individual frames or vwebp to view this image. Decoding of /tmp/magick-12WzNO-IXVTG78 failed. Status: 4(UNSUPPORTED_FEATURE) convert-im6.q16: unable to open image `--resize': No such file or directory @ error/blob.c/OpenBlob/2701. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504. convert-im6.q16: unable to open image `220x': No such file or directory @ error/blob.c/OpenBlob/2701. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504. convert-im6.q16: delegate failed `'dwebp' -pam '%i' -o '%o'' @ error/delegate.c/InvokeDelegate/1949. convert-im6.q16: unable to open file `/tmp/magick-121td0HBb9wtim': No such file or directory @ error/constitute.c/ReadImage/544. convert-im6.q16: no images defined `220px-file.webp' @ error/convert.c/ConvertImageCommand/3258. $ convert -version Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org Copyright: © 1999-2017 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules OpenMP Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
I'm not sure exactly when imagemagick started supporting animated webp, and I don't know when Debian started compiling with the webp delegate included. Based on this it should work in Buster. I'll have to test a bit more on Buster, but for now I'm calling it blocked on T216815: Upgrade Thumbor to Buster.
If we directly thumbnail to awebp, we'd probably want to think about if there should be an equivalent to MAX_ANIMATED_GIF_AREA for awebp. Thumbnailing to gif would include that restriction.
For Animated PNG, we render to a still frame png when we thumbnail. Note that this is primarily a side effect of the pipeline if i'm not mistaken. It was never much of an active decision.
Yeah, animated PNGs and SVGs not animating in thumbnails is a result of a lack of support for apng in ImageMagick and CSS animation in librsvg, respectively. I did find libraries that can convert apng to gif (or webp), so we could make it work by converting to a different format first. Only other way would be to explode the file into individual frames, resize each, then put it back together again.
Not sure which is worse: thumbnailing an apng to a gif or a static png.