Better handling of different PIL image types