Learn Before
Code
Color Transformation Example (Pillow)
# importing image class from PIL package from PIL import Image # creating image object img = Image.open(r"C:\Users\System-Pc\Desktop\scene3.jpg") # using convert method for img1 img1 = img.convert("L") img1.show()
The above code opens a JPEG image named scene3 and then converts it into a grayscale photo, as indicated by convert() function being called with the value "L" for the mode argument. The newly converted image is then shown.
0
1
Updated 2021-07-17
Tags
Python Programming Language
Data Science