0% found this document useful (0 votes)
7 views25 pages

unit-3 image processing

This document covers simple graphics and image processing in Python, focusing on the 'Turtle' module for 2D drawing and the basics of digital images. It explains the types of digital images (raster and vector), color models (RGB, Grayscale, CMYK, HSV), and introduces the Pillow library for image processing. An assignment is included, requiring the drawing of shapes using Turtle and performing image manipulations with the image module.

Uploaded by

madhurb2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views25 pages

unit-3 image processing

This document covers simple graphics and image processing in Python, focusing on the 'Turtle' module for 2D drawing and the basics of digital images. It explains the types of digital images (raster and vector), color models (RGB, Grayscale, CMYK, HSV), and introduces the Pillow library for image processing. An assignment is included, requiring the drawing of shapes using Turtle and performing image manipulations with the image module.

Uploaded by

madhurb2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Unit - 3

simple graphics and Image Processing


CONTENT
● “Turtle” module
● Simple 2D drawing- colors, shapes
● Digital images
● Image file formats
● Image processing- simple image manipulations with “image” module
“Turtle” module
● “Turtle” is a Python feature like a drawing board, which lets us command a
turtle to draw all over it!
● We can use functions like turtle.forward(…) and turtle.right(…) which can
move the turtle around.
Commonly used turtle methods are :
Commonly used turtle methods are :
Plotting using Turtle

To make use of the turtle methods and functionalities, we need to import


turtle.”turtle” comes packed with the standard Python package and need not be
installed externally. The roadmap for executing a turtle program follows 4 steps:

1. Import the turtle module


2. Create a turtle to control.
3. Draw around using the turtle methods.
4. Run turtle.done().
Plotting using Turtle
Digital Images in Python
A digital image is a representation of a visual scene in the form of a collection of pixels. Each pixel (picture element) contains color
and brightness information, which together form the entire image.

1. What is a Digital Image?


A digital image is made up of small units called pixels, arranged in a grid. Each pixel has color information stored as numbers.

Example: A 4x4 Pixel Image

Imagine a very small image with only 4x4 pixels:

Each pixel stores color as (R, G, B) values (Red, Green, Blue).


Types of Digital Images
1. Raster (Bitmap) Images

● Composed of pixels arranged in a grid.

● Each pixel has a specific color value.

● Quality depends on resolution (higher resolution = better quality).

● Examples: JPEG, PNG, BMP, GIF, TIFF

2. Vector Images

● Composed of mathematical shapes (lines, curves, and polygons).

● Can be scaled to any size without losing quality.

● Used for logos, icons, and illustrations.

● Examples: SVG, AI, EPS, PDF


Image Resolution
Color Models in Digital Images
Digital images can be stored in different color models.

1. RGB (Red, Green, Blue)

● Most common color model for screens.

● Each pixel has 3 values: Red (R), Green (G), and Blue (B), ranging from 0 to 255.
Color Models in Digital Images
2. Grayscale

● Uses a single intensity value for each pixel (0 to 255).

● 0 = Black, 255 = White.

3. CMYK (Cyan, Magenta, Yellow, Black)

● Used for printing.

● Subtractive color model (unlike RGB).

4. HSV (Hue, Saturation, Value)

● Represents color in terms of hue (color), saturation (intensity), and value (brightness).

● Used in image editing software.


Image Processing with Python (Pillow Library)

● PIL is the Python Imaging Library which provides the python interpreter with
image editing capabilities.
● It was developed by Fredrik Lundh and several other contributors.
● Pillow is the friendly PIL fork and an easy to use library developed by Alex
Clark and other contributors. We’ll be working with Pillow.
Assignment:

● Draw a circle and a parallelogram using “turtle”


module.
● Using “image” module :
1. Blur the image.
2. Convert the image into black & white.

You might also like