PySide Image Formats



  • I'm trying to use windows with PySide. However my code that ran fine in Linux doesn't want to work in windows. I'm creating a QImage and then using loadFromData() to load the data from a string. The image format is JPEG which is normally supported via a plugin. However that plugin doesn't seem to have been installed with PySide. I tried using addLibraryPath to point to the plugins but that didn't work either. I still get a isNull() == true image back.

    *edit * It seems that the issue is that PySide isn't loading any plugins.

    Here's what I currently have:

    @from PySide.QtGui import QImage
    from PySide.QtGui import *
    from PySide.QtCore import *

    import sys

    app = QApplication(sys.argv)
    app.addLibraryPath("f:\tmp\imageformats")
    app.addLibraryPath("f:\tmp")

    for v in QCoreApplication.libraryPaths():
    print v
    for v in QImageReader.supportedImageFormats():
    print v
    app.flush()
    img = QImage();
    img.load("c:\tmp\hp.JPG");
    if img.isNull():
    print "failed"
    else:
    print "works"@

    Still, no matter what I do, It always fails. The list out of formats includes .pngs which load fine. But the .jpg plugins are not loading. And therefore fail.
    Any ideas?



  • This is a bug on PySide windows package, they do not contain the necessary Qt plug ins. I recommend to you, remove the Qt dll installed with Pyside package, and install the official Qt package.



  • That did the trick! I copied the contents of the Qt/bin directory into the Python26/Lib/site-packages/PySide overwriting all the QT files there. And it works like a charm.



  • tbcpp, Roman Lacko (the guy who volunteered to do the Windows packaging) told he's aware of the issue and the next installer contains the plugins (including a currently missing sqllite plugin).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.