[PyKDE] PyQt4: Problems with QImage.loadFromData(data)
    Andreas Pakulat 
    apaku at gmx.de
       
    Mon Mar 13 19:31:43 GMT 2006
    
    
  
On 13.03.06 18:33:32, com at heuel.org wrote:
> Dear all
> 
> I would like to use the function loadFromData of QImage, specifically
> with PIL. But the code
> 
> [...]
>         imagePIL = Image.open(fileName)       # e.g. a PNG file
>         data = self.imagePIL.tostring()            # this should
> contain the data
> 
>         image = QtGui.QImage()
>         image.loadFromData(data)
> 
> [...]
> 
> Why doesn't this work?
Have you checked what tostring() returns? Here I don't get something
that looks like an image (4K of mostly 00)
Also I don't think you can convert this easily, it might be easier to
write out to a temporary file and read that one back in.
Andreas
-- 
You will inherit some money or a small piece of land.
    
    
More information about the PyQt
mailing list