I want it to be smarter and choose quasi-optimal settings for me automatically. Dropping an almost entirely solid white PNG on it, the initial suggestion is to convert to JPEG which _increases_ the size rather than decreasing it!
The Squoosh CLI has an auto-optimizer that will make an image as small as possible while staying under a given Butteraugli threshold, but you still have to decide on the format yourself.
If you take a 320x image and display it at 320x CSS pixels, it'll look blurry on the vast majority of mobile devices, and a lot of laptops, because 1 CSS pixel is larger than 1 device pixel.
https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
Fwiw this is covered in the article https://jakearchibald.com/2020/avif-has-landed/#what-is-acce...
I think you should optimise for regular display size and density.