Fernando Perez wrote:
> On 4/6/07, Darren Dale <[EMAIL PROTECTED]> wrote:
>> On Friday 06 April 2007 04:37:46 pm Fernando Perez wrote:
>>> import sys
>>> import numpy as N
>>> import pylab as P
>>>
>>> print "Numpy version:",N.__version__
>>> sys.stdout.flush()
>>>
>>> P.imshow(N.ones((4,4),dtype=N.uint8))
>>> P.show()
>> Yep, I also see it, with svn 3163. It looks like the problem is only with the
>> uint8 data type, I cant reproduce it with any other types.

char _image_module_frombyte__doc__[] =
"frombyte(A, isoutput)\n"
"\n"
"Load the image from a byte array.\n"
"By default this function fills the input buffer, which can subsequently\n"
"be resampled using resize.  If isoutput=1, fill the output buffer.\n"
"This is used to support raw pixel images w/o resampling."
;
Py::Object
_image_module::frombyte(const Py::Tuple& args) {
   _VERBOSE("_image_module::frombyte");

   args.verify_length(2);

   Py::Object x = args[0];
   int isoutput = Py::Int(args[1]);

   PyArrayObject *A = (PyArrayObject *) 
PyArray_ContiguousFromObject(x.ptr(), PyArray_UBYTE, 3, 3);

   if (A->dimensions[2]<3 || A->dimensions[2]>4)
       throw Py::ValueError("Array dimension 3 must have size 3 or 4");

It looks to me like the return from PyArray_ContiguousFromObject needs 
to be checked, and an exception thrown if necessary.

Unless I hear shortly that someone else is already fixing this, or that 
I am misdiagnosing the problem, I will proceed.  It may be that checking 
for 3-D needs to be done earlier in the mpl python code as well, but it 
certainly seems like it should be done here.

Eric

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to