Override global JPEG quality value based on cookie
This would need a bunch of image styles, a custom field formatter, a custom module that reads that cookie value, and a speed test of some sort.


You'd need to create image styles for each of the quality tiers that you want. That part can be done with the built-in image styles module.
Then you'd want to create a custom module that:


Detects the speed of the client's connection and sets that cookie. It can simply be JS downloading a 1KB file download whose start and end times are recorded and set on a cookie.
Supplies a custom field formatter to image fields that, instead of making you select a fixed quality, will select the image style and render the image with that image style on-the-fly. As an added bonus, you could allow the formatter to be configurable by exposing a form that allows the selection of which image style to use at certain speeds.
Lastly, detects the cookie that was set earlier and informs the field formatter which image style to use based on the cookie value.



This assumes that all imagery are coming from fields (because of the field formatter). For theme imagery, you'll need to render your images by hand in the same way as above, sans the field formatter.