[PyQt] Pixel Manipulation Very Slow?
zhang jian
zhangmdev at gmail.com
Fri Aug 20 13:21:29 BST 2010
Hello,
This is my first post. I want to write a simply app layering several images
each with different weighting. This problem is pixel manipulation by QImage
appears to be quite slow. My code is:
w = image.width()
h = image.height()
for j in range(h):
for i in range(w):
col = QtGui.QColor(image.pixel(i, j))
col.setRed(col.red()*self.fKd)
image.setPixel(i, j, col.rgb());
painter.drawImage(0, 0, image)
Just one image changed in red channel. It took about 5 seconds to redraw a
1280 X 720 image any time I changed Kd. Far from interactive. I'd like to
know is there any way to do stuff like that faster? Or calculating a million
pixels in PyQt is just a bad idea? Any advice should be appreciated.
Thanks,
zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100820/e7c25fbd/attachment.html>
More information about the PyQt
mailing list