[Image-SIG] Plotting many point's with PIL

Chuck Bass cbass233 at yahoo.com
Tue Nov 18 14:07:45 EST 2003


I'm using Numarray and PIL with good results. My data has 10's of 10000's of points so efficiency
is important (60seconds of plot time is not acceptable for this app). I've found that PIL was not
really designed to support very large data sets (though it is the best out there).  I can plot 2D
numarray data directly using something like

  draw.point(data.flat,fill)
 
I've found that I must flatten to get the numarray data to plot.  This is MUCH faster than having
python loop through the data.
 
However I need to draw each point with a different color to represent errors.  Doing this requires
me to loop through the points:
 
    for point,color in zip(points,colors):
        draw.point(point,color)

This is slow.  So the question is how big of a task would it be to make the PIL support a sequence
of fill colors?  To make it compatible with current code it would be nice to be able to say:

  draw.point(data.flat,fill_seq)

Where fill_seq was a sequence 1/2 th size of data.flat, or

    data.point(data.flat,data=xyzcolor)

Where the data is (x,y,color,x,y,color...) or ( (x,y,color),(x,y,color)...)

Either one of these options would allow the low level C code to sequence through the point/color
data quickly.

Would this be tough to add (or can I already do it;->).  I've done lot's of C and C++ but I
haven't worked with Python extensions (yet?).

Chuck

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



More information about the Image-SIG mailing list