Sorry for copypasting, I get this question a lot.
Optimage can do automatic lossy (visually lossless) optimizations on JPEGs and PNGs. It means you don't have to manually tune JPEG quality for each image and can get some PNGs quantized to 256 colors if visual differences are negligible.
It uses a modified quality metric based on Contrast Sensitivity Function (CSF) and contrast masking of DCT coefficients for JPEGs, and a custom one for color-quantized PNGs (major difference is sensitivity to noticeable gradients).
Optimage has a lot of tweaks to compression algorithms to squeeze some more bytes (Pareto principle here). But much more bytes are saved by exhaustively trying all possible image data representations, e.g. fast brute forcing of PNG delta filters, dirty alpha, palette sorting.
There's a good PNG test corpus at http://css-ig.net/images/png-test-corpus/png-test-corpus-201.... Optimage – 276 058 bytes, ImageOptim – 297 561 bytes. But this is just a lossless test.
> Also are you going to support and fix the frequent bugs that png optimizers run into with esoteric color space/alpha combinations beyond the best effort...?
At some stage, yes. Right now I'm focused on things like losslessly rotating JPEGs according to Orientation meta in Exif, adding CMYK to RGB convertion when Convert to sRGB is ON, supporting container formats like ICO and ICNS, more tweaks to compressors for performance and smaller output, GUI improvements, etc.