You are stuck with using whatever compression methods any browser will support for that image type. In other words, there may well be better methods out there, but a browser will not be able to use them. JPEG allows you to trade off quality for increased compression -- it's up to you how much information (high frequency data) you are willing to lose. GIF is designed to be a "lossless" compression method, which doesn't compress as much as JPEG, which is willing to lose information (quality) to achieve higher compression. In both formats (GIF and JPEG), there may well be things you can do in the design of the graphic that will allow higher compression, but that's not something that the image processor can do anything about. Obviously, a solid color will compress very well, but that's not usually an interesting graphic.
There are no magic bullets in image compression. "Optimizing" in an image processor may well work by removing some information that doesn't compress well (such as high frequency data), but it's up to you to decide if it's worth it. In the end, each image type has a compression method which the browser knows how to use (to decompress the image), and you have no choice about that.