CLI tool for batch processing images with ability to listen directory for the new files.
Functions:
- change image file format
- threshold
- blur
- resize
- rotate
- mirroring
- watermarking
pip3 install -r requirements.txt
python imgtool.py --extension=jpg - convert images to jpg format.
Available formats:
- Windows bitmaps - *.bmp, *.dib (always supported)
- JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section)
- JPEG 2000 files - *.jp2 (see the Note section)
- Portable Network Graphics - *.png (see the Note section)
- WebP - *.webp (see the Note section)
- Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported)
- PFM files - *.pfm (see the Note section)
- Sun rasters - *.sr, *.ras (always supported)
- TIFF files - *.tiff, *.tif (see the Note section)
- OpenEXR Image files - *.exr (see the Note section)
- Radiance HDR - *.hdr, *.pic (always supported)
- Raster and Vector geospatial data supported by GDAL (see the Note section) Documentation
python imgtool.py --action=threshold - threshhold images. default threshold value is 11, to set another value use flag --threshold=value should be odd number example: python imgtool.py --action=threshold --threshold=5
python imgtool.py --action=blur --blur=11 - default blur value is 5, --blur=value should be odd number
python imgtool.py --action=resize --scale=25 - default scale value is 50%
python imgtool.py --action=rotate --degree=25 - default degree value is 90
python imgtool.py --action=mirror - horizontal mirroring only
python imgtool.py --action=watermark --watermarkImage=path to image - add watermark image to bottom left corner
python imgtool.py --action=watermark --watermarkText=some text - add watermark text to bottom left corner
Flag | Description | Default | Example |
---|---|---|---|
--path | Path to images | input | --path=/folderName |
--watch | Observe folder for the new files | False | --watch |
--threshhold | Threshold value | 11 | --threshold=11 (should be odd) |
--blur | Blur value | 5 | --blur=5 (should be odd) |
--threshAdaptiveMethod | Documentation | ADAPTIVE_THRESH_MEAN_C | --threshAdaptiveMethod=ADAPTIVE_THRESH_GAUSSIAN_C |
--threshType | Documentation | THRESH_BINARY | --threshType=THRESH_TOZERO |
--thresholdConstant | 2 | --thresholdConstant=2 | |
--extension | extension of the output files | png | --extension=jpg |
--scale | scale persantage | 50 | --scale=25 |
--degree | Rotation degree | 90 | --degree=45 |
--watermarkImage | Path to watermark logo | - | --watermarkImage=path |
--watermarkText | watermark text | - | --watermarkText=some text |
--action | User should chose concrete action | defult | --action=watermark --watermarkText=some text |
- OpenCV https://opencv.org/
- Watchdog https://pypi.org/project/watchdog
- pip install opencv-python
- pip install watchdog
pyinstaller tbd