Image: handle images with zero columns or rows.

Two methods in the _image extension module now raise an
exception if the number of rows or columns is zero;
previously they could segfault.  A particular
circumstance that can cause this (setting xlim completely
outside the image extent) is handled directly in the
image module without raising an exception.

Closes #3091.