An extensible collection of small automation tools. The first tool resizes images while preserving their aspect ratio by default.
- Python 3.12 or newer
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .Provide one dimension to preserve the original aspect ratio:
work-toolkit resize input.jpg output.jpg --width 1200
work-toolkit resize input.png output.png --height 800During development, use the equivalent module command without installing the console script:
PYTHONPATH=src python -m work_toolkit resize input.jpg output.jpg --width 1200Provide both dimensions to fit the image inside that bounding box without cropping:
work-toolkit resize input.jpg output.jpg --width 1200 --height 800If the output path already exists, the command asks whether to overwrite it.
Enter y to overwrite, or enter a different output path when prompted. Leave
the replacement path blank to cancel the command.
Use --directory when input and output are folders. Every supported image
inside the input folder (including subfolders) is resized and written below the
output folder with the same filename and relative subfolder path.
work-toolkit resize photos resized-photos --width 1200 --directoryThe output filename must end in .webp. By default, conversion uses lossy
WebP with a quality level of 80.
work-toolkit convert-webp input.png output.webp
work-toolkit convert-webp input.jpg output.webp --quality 90
work-toolkit convert-webp input.png output.webp --losslesscompress uses Pillow locally; it never sends an image to TinyPNG or any other
external service. PNG output uses adaptive palette optimization and maximum
lossless compression. JPEG and WebP output use perceptual compression at a
quality of 85 by default, which is intended to keep visual changes minimal.
work-toolkit compress input.png compressed.png
work-toolkit compress photo.jpg compressed.jpg --quality 90
work-toolkit compress photo.png compressed.webp --quality 85To compress a folder of PNG, JPEG, and WebP files, use --directory. Files in
subfolders are included and written under the output folder with the same
relative path and filename.
work-toolkit compress photos compressed-photos --directoryFor PNGs, --colors sets the maximum adaptive palette size (2–256; default:
256). Lower values can shrink files further but may introduce visible banding
or color changes.