Resizing pictures in PIL in Tkinter

I'm currently using PIL to display images in Tkinter. I'd like to temporarily resize these images so that they can be viewed more easily. How can I go about this?

Snippet: = ImageTk.PhotoImage( = TK.Label( ,,borderwidth=0),row=0)


Here's what I do and it works pretty well...

image =
image = image.resize((250, 250), Image.ANTIALIAS) #The (250, 250) is (height, width) = ImageTk.PhotoImage(image)

There you go :)


Here is my import statement:

from Tkinter import *
import tkFont
import Image #This is the PIL Image library

And here is the complete working code I adapted this example from:

im_temp =
im_temp = im_temp.resize((250, 250), Image.ANTIALIAS)"ArtWrk.ppm", "ppm") ## The only reason I included this was to convert
#The image into a format that Tkinter woulden't complain about = PhotoImage(file="artwrk.ppm")##Open the image as a tkinter.PhotoImage class()
self.Artwork.destroy() #erase the last drawn picture (in the program the picture I used was changing)
self.Artwork = Label(self.frame, #Sets the image too the label = ##Make the image actually display (If I dont include this it won't display an image)
self.Artwork.pack() ##repack the image

And here are the PhotoImage class docs:

Note... After checking the pythonware documentation on ImageTK's PhotoImage class (Which is very sparse) I appears that if your snippet works than this should as well as long as you import the PIL "Image" Library an the PIL "ImageTK" Library and that both PIL and tkinter are up-to-date. On another side-note I can't even find the "ImageTK" module life for the life of me. Could you post your imports?

Need Your Help

jquery accordion scrolls to top on activate, then breaks on second click

jquery jquery-ui

I am trying to create a jquery accordion which scrolls to the top of the link that is clicked. The following code achieves this, but breaks when the link is clicked for a second time:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.