title: How can i display a resized image in python tkinter
body: <p>I'm developing a GUI in Python using Tkinter to learn image processing. GUI's process flow would be as</p>
  
  <p>Load image (jpg|png|...) => Resize/ thumbnail image (240 * 240) => Preview image</p>
  
  <pre><code>from Tkinter import *
  import PIL
  class Window:       
      def __init__(self, master):
          master.title("Image Processing test")
          master.minsize(800, 400)
  
          from PIL import Image
          im = Image.open("IMG_0562.png")
          size = 240, 240
          im.thumbnail(size)
          p = im.tobytes()
  
          # photo = PhotoImage(file="IMG_0562.gif")
          # photo = BitmapImage(data=p)
          w = Label(root, image=photo, width=240, height=240).grid(row=20, column=2)
          self.photo = photo
  
  
  root = Tk()
  
  window = Window(root)
  
  root.mainloop()
  </code></pre>
  
  <p>My problem is I couldn't get the image in a proper format to use it in <code>Label</code>. As <code>Label</code> only accepts <code>PhotoImage</code> and <code>BitmapImage</code>. <code>PhotoImage</code> doesn't support <code>png</code> or <code>jpg</code> file. So I used <code>Image</code> from <code>PIL</code> to load and resize my colored image. I've tried <code>Image.tobitmap()</code> and <code>Image.tobytes()</code> too but not useful in this case.</p>