Retrieve JPEG image from a redirected URL and display it on a GUI window
Question: I'm trying to download a JPEG file from a URL and display it on a tkinter GUI
window

This is the code I am trying to use to download and display the JPEG:

    
    
    picURL = "https://graph.facebook.com/" + ID + "/picture"
    picBytes= urlopen(picURL).read()
    picData = io.BytesIO(picBytes)
    picPil = Image.open(picData)
    picTk = ImageTk.PhotoImage(picPil)
    label_9 = Label(image = picTK, bg = "blue").pack()
    

The problem is that the image isn't showing up. All I get is a blue box. How
can i make it so the picture is shown?

Thanks

Im using python 3.3 on windows


Answer: What library are you using to access the image? I would recommend
[requests](http://docs.python-requests.org/en/latest/ "requests"). It
automatically handles redirects for you:

    
    
    import requests
    import Image
    from StringIO import StringIO
    
    r = requests.get(https://graph.facebook.com/userID/picture)
    im = Image.open(StringIO(r.content))
    

