3

I need to open a png image file and display it. I am able to open the file using PIL

from PIL import Image
f = Image.open("file.png").show()

I am getting a error message: " an error is preventing the video or image from being displayed Error code 0x800706ba

Does anyone know whats going wrong here?

balibakbar
  • 259
  • 3
  • 6
  • 11
  • I knew I had answered a similar problem before: http://stackoverflow.com/questions/8932976/python-imaging-library-show-on-windows – Mark Ransom Apr 29 '12 at 14:50

1 Answers1

3

On Windows, PIL uses whatever program is registered to open a temporary .BMP file. When the program returns, the temporary file is deleted.

By far the most common problem is that the program sends back a return code even before it even opens the file, and the file is deleted before it can be opened. Unfortunately the default viewer in Windows Vista and 7 has this problem; XP used the Microsoft Image and Fax viewer which was OK.

You can use File Explorer to change the program associated with .BMP files.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622