For jpeg images there are tools that remove useless exiff data and therefore reduce the weight of the image without loosing any quality. Some tools like webresizer let you compare the optimized and the non optimized image side by side, so that you can compare if the optimization is worth it while producing a similar image without a too heavy quality loss.
There is also a really great online tool from Yahoo, called smushIt you should try out if you haven't already. Unfortunately smushIt has no Api yet you could use in your deployment script(s). But if you want to build your own smushit like images optimization tool, take a look at smushit's FAQ where they list the tools they use.