Rebuild images only if they need to be