Chaining command to optimize image size