<html>
Thank for the source code.&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp; def __init__(self, filename, *args):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apply(QWidget.__init__,
(self,) + args)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.pixmap = QPixmap()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #if not
self.pixmap.load(filename): # Qt2/Linux loads *.gif and *.jpg!<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 1:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print
'Could not load &quot;%s&quot;, converting to &quot;%s.png&quot;' %
\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(filename, filename)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image
= Image.open(filename)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
image.save(filename + '.png') # saved format depends on extension<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
self.pixmap.load(filename +
'.png')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
self.setBackgroundPixmap(self.pixmap)&nbsp;&nbsp;&nbsp; <br>
<br>
app = QApplication(sys.argv)<br>
# lena.gif and lena.jpg are included in the PythonWare Imaging
Library<br>
demo = Viewer(&quot;lena.jpg&quot;) # or demo =
Viewer(&quot;lena.gif&quot;)<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&amp;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>