[PyQt] QImage.save() traceback

David Boddie dboddie at trolltech.com
Fri May 9 18:07:12 BST 2008


On Thursday 08 May 2008 18:18, Sergi Blanch i Torné wrote:

> I want to start adding this to the sample-script. By the way in the widget, 
> after a constructor like:
> image = 
> QtGui.QImage(imgData8,imgDimX,imgDimY,imgDimX,QtGui.QImage.Format_Indexed8)
> 
> I wrote this:
> image.setNumColors(256)
> for i in range(256):
> 	rgb = QtGui.QColor(i,i,i).rgb()
> 	image.setColor(i,rgb)
> 
> Is this what you mention? Or you refere to create an instance of QPalette?

I think you have to set a color table using your image's setColorTable()
method:

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qimage.html#setColorTable

David
-- 
David Boddie
Lead Technical Writer, Trolltech ASA



More information about the PyQt mailing list