On Sun, 24 Feb 2008 [EMAIL PROTECTED] wrote:

>    1. QImage from Python buffer (Jeremy Sanders)

> From: Jeremy Sanders <[EMAIL PROTECTED]>
> Subject: [PyQt] QImage from Python buffer
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
> Hi -
>
> Would it be possible to add support to create a QImage from a Python buffer
> object?
>
> I want to be able to quickly convert numpy arrays to QImages for display.
> Currently I have to convert the numpy to a string, then the string to a
> QImage.
>
> it would be nice to do
>
> QImage(numpyarray.data, 100, 100, QImage.Format_RGB32)
>
> where numpyarray is a 100x100x4 8 bit array.
>
> Thanks
>
> Jeremy
>
> --
> http://www.jeremysanders.net/
>

What you want is the toQImage function that is supplied as part of
the PyQwt package. The QwtImagePlotDemo.py example included with PyQwt
uses the function in a worked example.

Cheers

Tony
___________
Tony Willis
National Research Council   [EMAIL PROTECTED]
Box 248                     (250)493-2277
Penticton, BC  V2A 6J9      fax: 493-7767
Government of Canada        Gouvernement du Canada

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to