Display an image read from a zip archive python
Question: I want to create a comic archive reader in python as an exercise to teach
myself more python but I've been having troubles trying to read different
image files from a zip archive without extracting the files and then display
them.

I found a website with an example (http://www.python-
forum.org/pythonforum/viewtopic.php?f=4&t=3607) that could only display .gif
images. The example uses `PhotoImage` (The Tkinter version not the PIL
version) which can accept a 64bit encoded string instead of an actual file.
From most of my research it looks like PIL is what I want to use to deal with
images other than gif but I can't find a way to call `PIL.ImageTk.PhotoImage`
in a similar way to the `Tkinter.PhotoImage`. to take a stream of data instead
of an actual file.

Is there any way that I can hand the data received from `zipfile.read()` to
`PIL.ImageTk.PhotoImage`? Is there another library I could use to handle the
images? Tkinter is not a requirement for the program I'm writing so if there
is a better widget framework that I should be using I don't mind changing.

EDIT: So I figured a way to do this with PIL and tkinter.

    
    
    z = zipfile.ZipFile("zipfile.zip", "r")
    
    data = z.read(z.namelist()[0])    #Read in the first image data
    dataEnc = StringIO(data)          #Encode the raw data to be used by Image.open()
    
    img = Image.open(dataEnc)         #Open the image
    pimg = ImageTk.PhotoImage(img)    #Make tk compatible image
    


Answer: You can use PythonMagick to create an `Image` like so:

    
    
    from PythonMagick import *
    
    data = zipfile.read()
    img = Image(Blob(data))
    

Then display it using wxPython as suggested in the PythonMagick
[readme](http://www.imagemagick.org/download/python/README.txt) under the
"Display" section.

