imageOps library from the PIL Import ImageOps autocontrast Method # PIL.ImageOps.autocontrast (Image, cutoff = 0, the ignore = None) # function calculates the histogram of the input image, the dark-cutoff portion becomes 0 becomes a bright portion 255 the colorize method #PIL .ImageOps.colorize (image, black, white) # L-function to obtain a black and white image, to color it white portions designated by RGB color black, white with black portion designated RGB color # a set point value image R-channel RGB image size is the size of the value x, the R channel as an example, it is assumed black color channel value R b, white color channel value R w, then the final output is x / 255 * w + (255 -x) / 255 * B Crop Allows you method # PIL.ImageOps.crop (image, border = 0) # four weeks the peripheral border pixel image removal equalize method # PIL.ImageOps.equalize (image, mask = None ) histogram equalizing image # expand method #PIL .ImageOps.expand (image, border = 20, fill = 'white') # Extended image boundary, border width, filled with Fill Fit Method PIL.ImageOps.fit # (image, size, method = 0, bleed = 0.0, = centering (0.5, 0.5)) # image into a size method size method, boundary bleed removing the flip method # PIL.ImageOps.flip ( image) # vertical flip image grayscale method # PIL.ImageOps.grayscale (image) # grayscale image becomes the invert method # PIL.ImageOps.invert (image) # image inversion, and invert the same method ImageChops mirror method # PIL.ImageOps.mirror (image) # left-right inverted image posterize method # PIL.ImageOps.posterize (image, bits) # image retention pixel value of each channel bit high bits solarize method # PIL.ImageOps.solarize (image, threshold = 128) # higher than the threshold value negated