Hands-On Image Processing with Python
上QQ阅读APP看书,第一时间看更新

Converting an image into grayscale

We can use the convert() function with the 'L' parameter to change an RGB color image into a gray-level image, as shown in the following code:

im_g = im.convert('L')   # convert the RGB color image to a grayscale image

We are going to use this image for the next few gray-level transformations.