Google App Engine gets angry about image files over 1M. http://code.google.com/appengine/docs/python/images/overview.html#Quotas_and_Limits
Given an arbitrary user-provided image, and the ability to run C code to pre-process it, is there any clever way to get down to 1M with maximum quality?
The brute-force way is to search for the compression level and resolution that result in a <1M file, by trying a series of JPEG quality settings and a series of scale factors.
Other than brute-force search, any ideas on a clever way to pick the best JPEG quality and scale factor to achieve 1M file size?
What might be some good heuristics, maybe assumptions about the percent compression achieved at various JPEG quality levels?
Brute force has the virtue of simplicity and likely it ll be fast enough anyway, but just curious.