Class 21 — March 12
Trying out a new pillow
Pillow is software — Go try and figure it out — For a thousand words
Look both ways
- Introduce Pillow for image generation and manipulation
- Module util.py
- Provides the ability to get photos into a Python program
- Module test-pillow.py
- Tests that the pillow module was successfully installed
- Program wahoo.py
- Lets you overlay a selfie with UVA orange and blue dots (for fun)
- Program gradient.py
- Paints a gradient (for fun)
- Program groovy.py
- Paints a psychedelic image (for fun)
- Program canvases.py
- Paints a series of colored images
- Program pillow_painting.py
- Demonstrates basic Pillow drawing commands
- Pillow is a library for manipulating images in Python. Unlike the math library and others we have used, Pillow is not part of the standard Python install; you have to add it yourself.
- To install Pillow on your laptop go here.
- For now the parts of Pillow of interest to us are:
- Image: Pillow representation of an image.
- ImageDraw: Pillow image drawing commands.
- The Image has one particular function of current interest to us:
Image.new( m, size, color='black' )returns a mode m new image, whose dimensions are size. The background of the image color. Parameter color is optional with a default value of black. For us,
mwill always be the string
sizewill always be an ordered pair of the form
( w, h ), where
wis the width of the image and
his the height of the image.
- Look over artifacts
- Review pillow_painting.py
- Review Pillow drawing module
- Review Pillow drawing epistle
- Checkout last semester artistry
- Checkout past artistry highlights