<html>
Thank for the source code. I guess saving it first as PNG
first is a possible solution :-)<br>
Still, is there anyway to load the image into memory directly without
having to save it as PNG first?<br>
<br>
Thanks<br>
ST<br>
<br>
At 09:22 AM 3/29/2001 +0200, Gerard Vermeulen wrote:<br>
<blockquote type=cite class=cite cite>Here is an example, which fills the
background of <br>
a future killer app with .gif or .jpg picture.<br>
<br>
--START--#!/usr/bin/env python<br>
<br>
import sys<br>
from qt import *<br>
import Image # the PythonWare Imaging Library<br>
<br>
class Viewer(QWidget):<br>
def __init__(self, filename, *args):<br>
apply(QWidget.__init__,
(self,) + args)<br>
self.pixmap = QPixmap()<br>
#if not
self.pixmap.load(filename): # Qt2/Linux loads *.gif and *.jpg!<br>
if 1:<br>
print
'Could not load "%s", converting to "%s.png"' %
\<br>
(filename, filename)<br>
image
= Image.open(filename)<br>
image.save(filename + '.png') # saved format depends on extension<br>
self.pixmap.load(filename +
'.png')
<br>
self.setBackgroundPixmap(self.pixmap) <br>
<br>
app = QApplication(sys.argv)<br>
# lena.gif and lena.jpg are included in the PythonWare Imaging
Library<br>
demo = Viewer("lena.jpg") # or demo =
Viewer("lena.gif")<br>
app.setMainWidget(demo)<br>
demo.show()<br>
app.exec_loop()<br>
<br>
--END--<br>
<br>
However, on Mandrake-Linux-7.2 and Qt-2.2.1 it works without<br>
the PythonWare Image Library. Therefore I had to replace the<br>
if not self ....<br>
by <br>
if 1:<br>
<br>
<br>
Gerard Vermeulen</blockquote><br>
<!-- VC_SIGTAG --><br>Sheng-Te
Tsao<br><table cellpadding=2 cellspacing=3 bgcolor=#ffffff><tr><td>Online
Status:
<a href="http://eudora.voicecontact.com/vc3/?tst%40eudoramail.com"><img NOSEND=1 height=16 width=100 border=0 src="http://eudora.voicecontact.com/servlets/presence?imgbase=status%252Fvc2final_email&channel=HEARME_VC20.SDK.%2523tst%40eudoramail.com"></a></td><td><a href="http://eudora.voicecontact.com/vc3/?tst%40eudoramail.com"><img border=0 NOSEND=1 height=25 width=75 src="http://eudora.voicecontact.com/vc3/images/email/vc2final/emailbtn_callsender.gif"></a></td><td><a href="http://www.eudora.com/products/voicecontact/"><img border=0 NOSEND=1 height=25 width=135 src="http://eudora.voicecontact.com/vc3/images/email/vc2final/download_eudora.gif"></a></td></tr></table><br></html>