0

I use print QtGui.QImageReader.supportedImageFormats() but in the output, there is no jpeg.
I searched the problem and find out that I need the *.dylib in plugins/imageformats.

So I moved it to py2.7/site-packages/PyQt4, but I still cannot load jpeg.

I use a python script, not py2exe, just python test_pyqt.py.

What should I do now?

Mac os x Mountain Lion 10.8.2, Python 2.7, PyQt4

Nikana Reklawyks
  • 3,233
  • 3
  • 33
  • 49
Joker
  • 19
  • 3
  • http://stackoverflow.com/questions/10477075/pyqt4-jpeg-jpg-unsupported-image-format – andrean Oct 06 '12 at 06:18
  • @andrean Hi,I have read that.But it tells me to reinstall the py2.7 as a admin.The py2.7 I currently use is installed when I install the os x .So I think it's installed as a admin.Actually I cannot find the "qt.conf" in my python dir.... – Joker Oct 06 '12 at 07:25
  • try to add the library path manually: app = QtGui.QApplication([]) and then app.addLibraryPath('/path/to/plugins/imageformats') – andrean Oct 06 '12 at 10:14
  • @andrean still not working :( – Joker Oct 06 '12 at 12:53
  • try reducing the path tu just '/path/to/plugins' – andrean Oct 06 '12 at 13:40
  • you can obtain the path to qt by using the function app.applicationDirPath() somewhere near that path should be the plugins folder as well, pass that path to setLibraryPath. also check if there's actually a 'libqjpeg.dylib' file under plugins/imageformats folder – andrean Oct 06 '12 at 13:51
  • @andrean still not working. But i do find something that may be helpful. I search on the internet and find out that both jpeg and gif are supported by dynamic libs.But when I print supportedImageFormats, the gif is in the list while jpeg not. And the libqjpeg.dylib & libqgif.dylib are in the same folder.... – Joker Oct 06 '12 at 14:53
  • @andrean And when I remove the all the dylib and print supportImageFormats, gif has disappeared! – Joker Oct 06 '12 at 14:59
  • if you scroll deep down there's someone who solved it on leopard, see his solution maybe helps: http://stackoverflow.com/questions/885906/enabling-jpeg-support-for-qimage-in-py2exe-compiled-python-scripts – andrean Oct 06 '12 at 16:06
  • @andrean Fail again...I'm going mad! But I think my situation is different, cause I can get the GIF support, while all the dylib in the same folder. – Joker Oct 07 '12 at 02:14

0 Answers0