[PyKDE] How to display GIF and JPEG

Gerard Vermeulen gvermeul at labs.polycnrs-gre.fr
Fri Mar 30 20:32:45 BST 2001

Well, on my Mandrake-7.2 Linux system all I would need is

p = QPixmap('Desktop/misc/picture/munch.scream.jpg')

If you don't want to get rid of Windoze ....
then, if you get


compile it (there is a makefile for Visual C++) and manage
to let Qt know that the jpeg library exists, you are rid of
the "png" step.

;-) Gerard

(and MicroSoft wants us to believe Linux is a TOY) 

Gey-Hong Gweon wrote:
> I just ran the following code segment in my PyQt program to perhaps do
> something similar to what you want to do without creating files. I hope
> this is helpful. As commented, I wonder if there is a way to do away
> with the "png" step somehow...?
> import Image
> image = Image.open ('Desktop/misc/picture/munch.scream.jpg')
> import StringIO
> s = StringIO.StringIO ()
> # Could the following three lines be simplified somehow??
> image.save (s, format = 'png')
> p = QPixmap ()
> p.loadFromData (s.getvalue ())
> gds.mdi.setBackgroundPixmap (p)

More information about the PyQt mailing list