Command line is definitely best for scriptability and repeatability.
The thing I like about ImageOptim is that it runs multiple strategies (for PNG and JPEG at least) and picks the best one. Plus its ease of use for one-off compressions can't be beat.