[PyKDE] Pixel from a QImage

Russell Valentine russ at coldstonelabs.org
Tue Apr 18 02:26:44 BST 2006


Aurel (DustyDingo) W. said the following on 04/16/06 20:57:
> I updated now to PyQt-x11-gpl-snapshot-20060407 and to sip-4.4.1 and
> QImage::pixel(int,int) works now, thanks.
> 
> The mature problem with all this Qt painting stuff is, that i must
> convert a QPixmap into a QImage when i want to get any information
> from pixel data, which is unbearable. It wouldn't be that
> catastrophic, if conversion worked, but it doesn't. The pixel data is
> falsified after converting it.

I don't know if this will be helpful or not, but when I was working on
a PyKDE application which displayed a image. I had two copies of the
data. One was the preferred format, or rather the main copy, which was a
object that let me do whatever I wanted (for you this seems to maybe be
QImage). The other was the displayed copy (QPixmap). When a change got
made I made the change on the main copy(QImage) and from that made the
pixmap.

Is it then not possible to make changes and keep around a QImage and
when QImage gets updated make a new QPixmap for it? You can then query
whatever pixel data you want without having to do some convert all the
time, you just access the main QImage data, only use QPixmap for display.

This worked really well for me at least, but it depends on what app is
doing. It has been a while since I was working on that, but I hope it helps.

Or if you really want to continue to just go from QPixmap to QImage. If
you send a example application that just shows this problem, more people
would probably look into it, or tell you what is wrong in the code, if
that is the case.


Russell Valentine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060418/62dc6ae0/signature.bin


More information about the PyQt mailing list