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 9011109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:38:33+00:00 2026-06-16T02:38:33+00:00

Can PIL open an image using pyqt4 resource file? from PIL import Image, ImageWin

  • 0

Can PIL open an image using pyqt4 resource file?

from PIL import Image, ImageWin
import res_rc #resource file

image = Image.open(":/images/image.png")
dim = ImageWin.Dib(image)

I’m getting this error

IOError: [Errno 22] invalid mode ('rb') or filename :/images/image.png'

  • 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-16T02:38:34+00:00Added an answer on June 16, 2026 at 2:38 am

    To read an image file from a resource, open it with a QFile and pass the raw data to a file-like object that can be used by PIL:

    from PyQt4.QtCore import QFile
    from cStringIO import StringIO
    from PIL import Image, ImageWin
    import res_rc
    
    stream = QFile(':/images/image.png')
    if stream.open(QFile.ReadOnly):
        data = stream.readAll()
        stream.close()
        image = Image.open(StringIO(data))
        dim = ImageWin.Dib(image)
    

    Note that resources are designed to be compiled into the application, and so they are strictly read-only.

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

Sidebar

Related Questions

I have created this program: from PIL import Image, ImageDraw a = Image.open(r'C:\Users\damian\Desktop\a.png') draw
from PIL import Image im = Image.open(f) #the size is 500x350 box = (0,0,100,100)
I have some strange problem with PIL not resizing the image. from PIL import
Consider the following code: from PIL import Image, ImageDraw, ImageFont def addText(img, lTxt): FONT_SIZE
from Tkinter import * import socket, sys from PIL import Image, ImageTk root =
I want to extend Image class in PIL. #module Image def open(file): ... class
I am using the Image.save method from PIL and I cannot find where the
How do I save an image file from data manipulated using image.load()? This is
I am trying to convert a PIL image into an array using NumPy. I
I am working on PIL and need to know if the image quality can

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.