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()
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.