print(imgobj width()imgobj height()show size in pixels on exit with pilour script is now able to display many image typesincluding the default jpeg image defined in the script and captured in figure - againrun with command-line argument to view other photos figure - tkinter+pil jpeg display displaying all images in directory while we're at itit' not much extra work to allow viewing all images in directoryusing some of the directory path tools we met in the first part of this book example - for instancesimply opens new toplevel pop-up window for each image in directory (given as command-line argument or default)taking care to skip nonimage files by catching exceptions--error messages are both printed and displayed in the bad file' pop-up window example - pp \gui\pil\viewer-dir py ""display all images in directory in pop-up windows gifs work in basic tkinterbut jpegs will be skipped without pil ""viewing and processing images with pil