PyQt4 jpeg / jpg unsupported image format

I am trying to get QImage (or something in PyQt4, for that matter) to load a JPG file in a script. I could not find any information on how to get it to load the jpg image as a script, a lot to compile using py2exe, but I can’t even go that far.

After spending some time to solve this problem, I kept track of several things that were not available. Looking at my site-packages / PyQt4 / plugins / imageformats folder, I have:

qgif4.dll, qico4.dll,qjpeg4.dll, qmng4.dll, qsvg4.dll, qtga4.dll, qtiff4.dll

According to QtGui.QImageReader.supportedImageFormats (), this is what my pyqt4 installation can use

[PyQt4.QtCore.QByteArray('bmp'), PyQt4.QtCore.QByteArray('pbm'), PyQt4.QtCore.QByteArray('pgm'), PyQt4.QtCore.QByteArray('png'), PyQt4.QtCore.QByteArray('ppm'), PyQt4.QtCore.QByteArray('xbm'), PyQt4.QtCore.QByteArray('xpm')]

I also made sure my qt.conf file is in the python main directory and has

[Way]

Prefix = C:/Python27/Lib/site-packages/PyQt4
Binaries = C:/Python27/Lib/site-packages/PyQt4

I tried to add

Plugins = C:/Python27/Lib/site-packages/PyQt4/plugins/imageformats
Plugins = C:/Python27/Lib/site-packages/PyQt4/plugins

no luck

Python 2.7.2 PyQt4 4.9.1 ( 32b) Windows 7 64b Home Premium.

4.8.1 4.8.5 ( ), jpg. . ?

+7
2

, , -, . , .

. PyQt4 " ", , , . , .

. , , QApplication , - .

app = QtGui.QApplication(sys.argv)

.

def main():
    app = QtGui.QApplication(sys.argv)
    win = window()
    win.display()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

, PyQt4 , jpegs .

script, PyQt4, , QApplcation. №2

: http://article.gmane.org/gmane.comp.python.pyqt-pykde/7176/match=jpeg+plugin+not+loading

QApplication, .

, , :

from PyQt4 import QtGui
QtGui.QImageReader.supportedImageFormats()

,

from PyQt4 import QtGui
import sys
app = QtGui.QApplication(sys.argv)
QtGui.QImageReader.supportedImageFormats()

, , , .

+8

- , , .

, QtCore.QCoreApplication.addLibraryPath() qt.conf.

0

All Articles