Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7957101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:11:47+00:00 2026-06-04T04:11:47+00:00

I’m trying to get QImage (or anything in PyQt4, for that matter) to load

  • 0

I’m trying to get QImage (or anything in PyQt4, for that matter) to load a jpg file in a script. I haven’t been able to find any information on how to get it to load a jpg image as a script, lots for compiled using py2exe but I can’t even get that far.

Spending some time to resolve this, I’ve followed a few things with no available. Looking in 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 install of pyqt4 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’ve also made sure that my qt.conf file is in the main python directory and it has this

[Paths]

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

I’ve tried adding

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

with no luck

I’m running python 2.7.2, with PyQt4 4.9.1(both 32b), on a windows 7 64b Home Premium.

I’ve also tried version 4.8.1 and 4.8.5 (which I had on hand) but none of them supported jpg either. I’m at a loss. How do I get these back to being supported?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:11:49+00:00Added an answer on June 4, 2026 at 4:11 am

    There are two different issues it seems that can contribute to causing this. And it looks like I ran into both.

    1st. I gave running the PyQt4 installer ‘as administrator’ which seems to have solved part of the issue. So it needs to be run as administrator to get everything to work correctly.

    2nd. In order for all the plugins to load properly, the QApplication must be made first before any kind of image is loaded.

    so

    app = QtGui.QApplication(sys.argv)
    

    needs to be created first.

    My scripts run as

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

    which hasn’t changed since I installed PyQt4 as an administrator but now works and loads jpegs and everything else.

    What I was trying to do, was create a script that was going to be called by a PyQt4 application but it wouldn’t be run by itself, so there was no need to create a QApplcation first. Which is where I ran into issue #2

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

    Install as administrator and always create the QApplication, even if you don’t need it.

    also if you are just checking to see what’s available in idle:

    from PyQt4 import QtGui
    QtGui.QImageReader.supportedImageFormats()
    

    won’t show everything, still need to run

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

    This was annoying to track down, so hopefully this will be helpful to others.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.