ImageOps is a module that contains ready-made image processing operations
from PIL import ImageOpsAfter loading the image, it can be converted to grey scale as:
image_gray = ImageOps.grayscale(image_)We can save the grey scale image and save intodesired format “jpg”
image_gray.save("NewImage.jpg")
# saving the grey file in New file called NewImage.jpg

To open grey scale images
from PIL import ImageOps
image_gray = Image.open(“image.jpg”) # to open grey scale image
image_gray.mode #to display mode
image_gray.quantize(2) # use quantize to quantize the image. The input is the number ofquantization levelsL means Luminance
To process with color images
Baboon = Image.open(“baboon.jpg”)
Red, green, blue = baboon.split()Good to Know
- Different RGB channels can be obtained as grey scale images and assign them to the variable red, green and blue using the method split()
- Red channel can be plotted as grey scale image. The red pixels in the grey scale plot of the red have a higher intensity
To process with color images



![]()
Views: 3