Proper logging in optimize_images

- log currently processed file on INFO
- display command output on DEBUG
- bonus: reduced the number of loops