genericize image utilities