[PyQt] QImage.save() traceback

David Boddie dboddie at trolltech.com
Thu May 8 15:14:24 BST 2008


On Thu May 8 10:11:18 BST 2008, Phil Thompson wrote:

> On Thursday 08 May 2008, Sergi Blanch i Torné wrote:
> > I don't like to be rude insisting, but after the script no one says
> > anything in the list. My question can be reduced to if it's possible to
> > have more information that a False when I save the image.
> 
> No.

What Phil and Pete are saying is that Qt doesn't provide enough information
about why saving fails, so there's nothing that PyQt can retrieve for you to
let you know what happened.

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. This may be something you should report
to Trolltech:

  http://trolltech.com/developer/task-tracker

Once you convert to different formats, it seems that a color table is created
and filled in with default values.

David
-- 
David Boddie
Lead Technical Writer, Trolltech ASA



More information about the PyQt mailing list