Refactor ImageOptimizer.