Python Imaging Library/File IO

From Wikibooks, open books for an open world
Jump to navigation Jump to search

File operations in PIL are very simple, and reflect normal Python methods.


import Image

img =


from PIL import Image

img ="path/to/image.ext")
pixels = img.load() # Load the pixels of the image into a matrix


Displays a copy of the specified image in a window.

from PIL import Image

img ="path/to/image.ext") # Shows the image in a new window


import Image

img ="example.png"), options...), format, options...)