It's probably best to expand the `quality` and `format` variables as well so those optimizations can take effect as well.