[PyQt] QImage.save() traceback

Sergi Blanch i Torné sbt at ya.com
Thu May 8 17:18:52 BST 2008


Hi!

Sorry but I didn't receive your mail for half an hour delay.

On Thursday 08 May 2008 10:27:34 Hans-Peter Jansen wrote:
> (...)
> I fear, you don't besides a qt rebuild with debugging enabled. Looking into
> the source will give you more hints.

I'll try this option also with the other suggestions of try it on c++, and 
having the Qapp. In parallel I'll rebuild qt with a debug flag.


On Thursday 08 May 2008 16:14:24 David Boddie wrote:
> (...)
> In your script, you initially create an indexed image, but you don't supply
> a color table, and presumably Qt doesn't create a default one for you. When
> you try to save this image as a PNG file, no palette data is available, so
> libpng is understandably upset. :-) Maybe QImage should check for this case
> before trying to write the image. 

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?

Thanks for your patience

/Sergi.


More information about the PyQt mailing list