-
Notifications
You must be signed in to change notification settings - Fork 1
createchmimage.py
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:
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
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
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
Running with --gaussianblur option
createchmimage.py corgi_small.png corgi_small_blur.png --gaussianblur
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