class_docstr: Adjust image contrast.
  
  This class can be used to control the contrast of an image, similar
  to the contrast control on a TV set. An enhancement factor of 0.0
  gives a solid gray image. A factor of 1.0 gives the original image.
class_docstr_tok: ["Adjust","image","contrast",".","This","class","can","be","used","to","control","the","contrast","of","an","image",",","similar","to","the","contrast","control","on","a","TV","set",".","An","enhancement","factor","of","0.0","gives","a","solid","gray","image",".","A","factor","of","1.0","gives","the","original","image","."]
code: def __init__(self, image):
      self.image = image
      mean = int(ImageStat.Stat(image.convert("L")).mean[0] + 0.5)
      self.degenerate = Image.new("L", image.size, mean).convert(
          image.mode
      )
  
      if "A" in image.getbands():
          self.degenerate.putalpha(image.getchannel("A"))
  
file_path: pillow/src/PIL/ImageEnhance.py
imports: from __future__ import annotations
  from .None import Image, ImageFilter, ImageStat
label_desc: Use image node_id 1 to create a new Contrast object from inherited base classes: _Enhance with example: obj = Contrast(image)