Crop a batch of images with the same margins. This script wraps the convert command provided by ImageMagic
This library is free to use under the MIT license. Any additions are very much appreciated, in terms of suggested functionality, code, documentation, testimonials, word-of-mouth advertisement, etc. Bug reports or feature requests can be filed on GitHub. As always, the code comes with no guarantee. None of the developers can be held responsible for possible mistakes.
Download: .zip file | .tar.gz file.
(c - MIT) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/batchcrop
conda install -c conda-forge batchcropThis will also install all necessary dependencies.
pip install batchcropThis will also install the necessary Python modules, but not ImageMagic.
# Download batchcrop
git checkout https://github.com/tdegeus/batchcrop.git
cd batchcrop
# Install
python -m pip install .This will also install the necessary Python modules, but not ImageMagic.
The usage is as follows (see batchcrop --help):
batchcrop
Crop a batch of images with the same margins.
Usage:
batchcrop [options] <image>...
Arguments:
The images to crop.
Options:
-a, --append=<str>
Append filenames, if empty the input files are overwritten. [default: ]
--background=<str>
Apply a background color (e.g. "none" or "white").
--flatten
Flatten input images: required for transparent PNG-files.
--temp-dir=<str>
Output directory for temporary images (deleted if not specified).
-v, --verbose
Print all executed commands.
-h, --help
Show help.
--version
Show version.
(c-MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus