Improve exception handling for image.read.

Limit warning detection to ImageMagick warnings, since those are stated
to be "fine to ignore." Simplifies the code a bit.
Fix compilation warning on GCC.