createchmimage.py - CRBS/chmutil GitHub Wiki
createchmimage.py will convert an image to grayscale, then optionally autocontrast, blur, and downsample the image saving it in png format.
By default only the conversion to grayscale is performed.
Please note, regardless of order of optional flags the operations are performed in this order utilizing the Pillow library:
- Grayscale
- Equalize
- AutoContrast
- GaussianBlur
- Downsample
For more information invoke createchmimage.py --help on the command line.
Examples below use the following image from Pixabay as input:

Example invocation no options
Running with no options will convert image to grayscale using Pillow ImageOps.grayscale and write the image out as png file.
createchmimage.py corgi_small.png corgi_small_grayonly.png

Example with equalize option
Running with --equalize option will convert image to grayscale and then using Pillow ImageOps.equalize equalize the image before writing it out as a png file.
createchmimage.py corgi_small.png corgi_small_equalize.png --equalize

Example with autocontrast option
Running with --autocontrast option will convert image to grayscale and then using Pillow ImageOps.autocontrast autocontrast the image before writing it out as a png file.
createchmimage.py corgi_small.png corgi_small_autocon.png --autocontrast

Example with gaussianblur option
Running with --gaussianblur option
createchmimage.py corgi_small.png corgi_small_blur.png --gaussianblur

Example with downsample option
Running with --downsample 2 option
createchmimage.py corgi_small.png corgi_smal_down2.png --downsample 2

Running with --downsample 4 option
createchmimage.py corgi_small.png corgi_smal_down4.png --downsample 4
