Make reading by ImageMagick more flexible

Still need to figure out how to extract the colormap, but everything else seems to be in place.