ImageEnhance Image Enhancement in PIL Module

ImageEnhance Image Enhancement in PIL Module

  • Chroma (ImageEnhance.Color): adjust the color balance of the image, an enhancement factor of 0.0 will produce a black and white image, an enhancement factor of 1.0 is the original image, the enhancement factor is greater than 1.0, the color saturation of the image will increase sequentially, and the enhancement factor will be less than 1.0. The color saturation decreases in order.

    enh_col = ImageEnhance.Color(image)
    image_colored = enh_col.enhance(1.5)
    
  • Brightness (ImageEnhance.Brightness): adjust the brightness of the image, an enhancement factor of 0.0 will produce a black image, an enhancement factor of 1.0 will maintain the original image, an enhancement factor less than 1.0 will darken the image brightness, if the enhancement factor is greater than 1.0, the image brightness will increase.

    enh_bri = ImageEnhance.Brightness(image)
    image_brightened = enh_bri.enhance(1.5)
    
  • Contrast (ImageEnhance.Contrast): Adjust the contrast of the image, an enhancement factor of 0.0 will produce a pure gray image, an enhancement factor of 1.0 is the original image, an enhancement factor greater than 1.0 contrast enhancement, an enhancement factor less than 1.0 contrast reduction.

    enh_con = ImageEnhance.Contrast(image)
    image_contrasted = enh_con.enhance(1.5)
    
  • Sharpness (ImageEnhance.Sharpness): Adjust the sharpness of the image, which reflects the sharpness of the image plane and the sharpness of the image edge. An enhancement factor of 0.0 will produce a blurred image, an enhancement factor of 1.0 is the original image, an enhancement factor greater than 1.0 sharpness enhancement, and an enhancement factor less than 1.0 sharpness weakening.

    enh_sha = ImageEnhance.Sharpness(image)
    image_sharped = enh_sha.enhance(1.5)
    

Reference materials
python image usage _Python image processing library PIL ImageEnhance module usage introduction
PYTHON use IMAGEENHANCE in the PIL module for image data enhancement

Guess you like

Origin blog.csdn.net/studyeboy/article/details/112007782