Optimize images only if modified