Catch PIL imread problems early and generate error message

This addresses problems seen in #1154 and #1091.
Is the pil_to_ndarray unused then?