Image{cache,style} for compression?
For Drupal 7, the best thing I've seen/used for this is ImageAPIOptimize.

To use it properly you can either use an external toolkit like Yahoo SmushIT! or different options on your server like optipng as you mention above, among others.  See screenshot for partial config screen.  I've run tests with GD, ImageMagick and this module and it produces the best results (in my testing).

Config screen from admin/config/media/image-toolkit: