[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QPixmap / QImage from numpy or string
From: Antonio Valentino <antonio.valentino () tiscali ! it>
Date: 2009-06-28 10:26:32
Message-ID: 20090628122632.2d5e1124 () tiscali ! it
[Download RAW message or body]
Il giorno Sun, 28 Jun 2009 10:34:21 +0200
Michael Held <michael.held@bc.biol.ethz.ch> ha scritto:
> hi,
>
> I am trying to create a QImage from a numpy array directly. this is
> not supported yet, right?
> has anybody tried to load a numpy array via a string into a QImage,
> like
Hi Michael,
in my code I use the following function
http://sourceforge.net/apps/trac/gsdview/browser/trunk/gsdview/qt4support.py#L64
It should work enough for 8bit grayscale images but it is not tested
for other image formats.
> a = numpy.zeros((100,50))
> image = QImage(a.tostring(), a.shape[0], a.shape.[1], a.shape[0],
> OImage.Format_Mono)
Providing bytesPerLine argument seems a good approach!
What kind of problems do you have with this code?
> thanks a lot!
> michael
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
--
Antonio Valentino
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic