Option to select format and compression degree for thumbnails

AI-generated summary

The discussion revolves around enhancing thumbnail generation in Discourse by adding options for format selection and compression control. ariznaf suggests allowing admins to choose between AVIF and JPEG formats for thumbnails, with AVIF being the preferred choice for its strong compression capabilities. They also propose a parameter to adjust the compression degree and mention that browser support for AVIF is generally good, with the exception of Microsoft Edge. merefield highlights the importance of resolution alongside compression, referencing a theme component that allows selecting different thumbnail resolutions. avidseeker inquires about automatically converting uploaded images to AVIF format and asks if Discourse uses ImageMagick for this purpose. They also mention checking if S3 services like Blackblaze offer compression options. tobiaseigen confirms that the requested feature is not currently supported but encourages further discussion on its merits.

Now that AVIF is available in the forum, I thought it would be great to be able to select that format for the thumnails that the forum generates from the provided images.

It would be great to be able to select avif for the photos that are uploaded and need compression due to exceeding forum stablished limits.

AVIF is a great format that shines when you need strong compression.
Main web browsers and mobile browsers support it (the only exception being MS Edge, but it seems next stable release will provide it).
For the forums that are conservative and need to work with old browsers, giving the option to select jpeg as compression would be great.

In my opinion, by default, the forum should maintain the original jpeg format, but give the admins the option to select jpeg of avif for all thumbnails and converted images.

A parameter to be able to control the degree of compressio for the authomatic conversion would be greatly wellcome.

If it where able to detect when a browser does not support AVIF and serve a jpeg image on the fly it would be great, but that is not an easy task, and may be not the philosphy of the developers.

I take this opportunity to congratulate the developers for implementing avif support, I have tested it and it works very well.

4 Likes

Resolution matters too, not just compression.

In Topic List Previews Theme Component you can select the resolution of the image shown on the interface:

The theme component asks core to create a set of thumbnails at different resolutions and this setting allows you to influence which set is shown.

2 Likes

How to set Discourse to automatically convert uploaded images (png, jpg) to avif format?

I presume Discourse uses Imagemagick in the backend for this? then it shouldn’t be too difficult to tweak the compression settings for Imagemagick to make it output avif?

I tried checking if S3 services such as Blackblaze offer compression on their end, but it seems this is something that has to be done by Discourse itself.

@avidseeker I merged your other Support topic into this one, since they are directly related. What you are asking for is not currently supported in Discourse as far as I know, but it’s worth talking about the merits of adding it is worth doing here in this Contribute > Feature topic.