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 it’s original size.

Comparative results:



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