Optional image optimization before upload

Continuing the discussion from Optimize images before uploading?:

This is a RFC for opt-in image compression/resize/optimization on the client side before the upload process. This will be experimented with using a theme-component. If proven useful, we will consider adding this feature in core for 2.8.


Users will be able to control client side optimization via a simple checkbox in the upload modal

Compression tech

At first we will experiment optimizing JPEGs, which are the most common uploads from users smartphones.

Our component will re-size the user upload if it’s larger than the max configurted size and re-encode it using MozJPEG.

In my tests this takes <10s in a mid-range Android phone, and compresses a typical photo to less than 30% of its original size.




Resized to 50% + Optimized


I am not sure if this should be an end user option, especially since they might just be cutting and pasting. Instead I think this is a site-operator kind of thing.

How much should images be optimized prior to uploading: “noting|a bit|a lot” …

Name/value and default pending.

The results look quite excellent! Also, in combination… maybe we make this 100% automatic for certain cases? You set the “maximum” size of images on your forum to 2000KB and we have a heuristic that kicks in and makes sure we take care of stuff.


A progress indicator would be very helpful here in case of multi-image uploads to let the user know something is happening.

Yes, please. Left up to users it will be used sporadically and non-savvy users will not understand the purpose.


A tool I like with 75 quick compression https://squoosh.app/

1 Like

It would be useful to have this as an admin option to enable where anything that exceeds site’s dimension/size settings gets automatically compressed. For more image intensive sites wouldn’t want this on all the time, but instead to cover use cases where less savvy users don’t need to worry about resizing.


This feature is almost ready, we should be able to test it soon:


Please check Testing composer image optimization