1/16
pythoncollegelevel
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Pixel
A tiny dot that makes up an image; each pixel encodes a color
RGB
Each pixel has 3 bytes (24 bits): one for red, one for green, one for blue
PIL
Python Imaging Library — provides tools for image processing in Python
PIL Functions
width
height
getpixel
pxred
pxgreen
pxblue
putpixel
width
Property Number of pixels wide
height
Property Number of pixels tall
getpixel
Function Returns RGB tuple at position (x, y)
pxred
Attribute Gets red value from a pixel
pxgreen
Attribute Gets green value from a pixel
pxblue
Attribute Gets blue value from a pixel
putpixel
Function Sets color of pixel at (x, y)
PIL Drawing Functions
line()
rectangle()
ellipse()
point()
text()
line()
start point, end point, color, width Draws a line between two points
rectangle()
top-left, bottom-right, fill, outline, width Draws a rectangle (filled or outline)
ellipse()
bounding box, fill, outline, width Draws circle/oval inside bounding box
point()
coordinates, color Draws dots at specified coordinates
text()
position, text string, color Adds text to image (top-left corner)