A highly opinionated image processor for the commandline.
Project description
Image Wrench
A highly opinionated image processor for the commandline. Multiple subcommands can be executed sequentially to form a processing pipeline.
imgwrench
is free software available under the MIT license.
Detailed documentation can be found at https://imgwrench.readthedocs.io.
Features
Subcommands can be executed sequentially to form a pipeline
Command blackwhite for converting images to black and white
Command collage creates a collage from multiple images
Command colorfix for fixing the colors of aged photographs
Command crop for cropping images to give aspect ratio
Command dither for converting images to black and white and dithering
Command filmstrip to stack images horizontally forming a filmstrip
Command flip to flip/mirror images left-right
Command frame to put a monocolor frame around images
Command framecrop top frame and crop an image to a target aspect ratio
Command quad collects four images to a quad
Command resize for resizing images
Command save for no processing, but saving images with the given parameters
Command stack for vertically stacking images
Installation
Make sure you have Python and pip installed and available in your $PATH.
Then imgwrench
can be installed with
pip install imgwrench
In order to install for the current user only, you may want to execute
pip install --user imgwrench
instead. In this case you will have to ensure that the local bin directory
(typically ~/.local/bin
on Linux systems) is contained in your $PATH.
Note that legacy Python2 is not supported. If your system still ships Python2 as the default Python interpreter, you may have to execute
pip3 install imgwrench
or
python3 -m pip install imgwrench
Usage
imgwrench
is used on the command line by piping file paths into it, e.g.
ls /path/to/my/images/*.jpg | imgwrench blackwhite
Full command line help is
Usage: imgwrench [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
A highly opinionated image processor for the commandline. Multiple
subcommands can be executed sequentially to form a processing pipeline.
Options:
-i, --image-list FILENAME File containing paths to images for processing,
defaults to stdin
-r, --repeat INTEGER repeat every image in input sequence [default:
1]
-p, --prefix TEXT prefix for all output filenames before numbering
[default: img_]
-d, --digits INTEGER number of digits for file numbering [default: 4]
-c, --increment INTEGER increment for file numbering [default: 1]
-k, --keep-names keep original file names instead of numbering
[default: False]
-f, --force-overwrite force overwriting output image file if it exists
[default: False]
-o, --outdir DIRECTORY output directory [default: .]
-q, --quality INTEGER quality of the output images, integer 0 - 100
[default: 88]
-e, --preserve-exif preserve image exif and xmp metadata if available
[default: False]
-j, --jpg / --png save output images in JPEG format (otherwise PNG)
[default: True]
--help Show this message and exit.
Commands:
blackwhite Convert color images to black and white.
collage Create a collage from multiple images.
colorfix Fix colors by stretching channel histograms to full range.
crop Crop images to the given aspect ratio.
dither Apply black-white dithering to images.
filmstrip Stack all images horizontally, creating a filmstrip.
flip Flip/mirror images left-right.
frame Put a monocolor frame around images.
framecrop Crop and frame an image to a target aspect ratio.
quad Collects four images to a quad.
resize Resize images to a maximum side length preserving aspect...
save No-op to enable saving of images without any processing.
stack Stacks pairs of images vertically, empty space in the middle.
Pipelines
imgwrench
subcommands can be combined into pipelines. This saves you from generating intermediate
files cluttering your filesystem or reducing the quality of the final results. For example, if you
want to convert all images in the current directory to black and white, put a white frame
around them and have them cut to an aspect ratio of 3:2 (for standard format printing), you would
execute the following command:
ls *.JPG | \
imgwrench -o out -q 95 -p oldschool_img_ \
blackwhite \
framecrop -a 3:2 -w 0.03 -c white
Please refer to the detailed subcommand documentation for the individual parameters.
Developer Notes
Should you run into the following exception while running imgwrench
from an editable install
importlib_metadata.PackageNotFoundError: No package metadata was found for imgwrench
try executing make dist
to regenerate the egg
files required bei importlib
which have likely been removed by a call to make clean
.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.17.0 (2022-11-12)
-r/--repeat
option for repeating input filesConstrain
click
version to<8.1
due to breaking API change; this will be relaxed in a future versionConstrain
Pillow
version to<9.0
due to breaking tests; this will be relaxed in a future versionDrop support for Python 3.6 and 3.7
Add support for Python 3.9 and 3.10
Upgrade dependencies
Migrate from travis-ci.com to GitHub actions
0.16.1 (2021-06-19)
Fix support for
click>=8.0
which has changed its behaviour regarding custom parameter types
0.16.0 (2021-01-23)
quad
subcommand supports doubling inner frame using the-d/--double-inner-frame
flag
0.15.0 (2021-01-22)
collage
subcommand selects best layout based on score functioncollage
subcommand supports-n/--number-tries
parameter to specify number of layout tries
0.14.0 (2021-01-21)
BREAKING CHANGE: replace golden collage approach with BRIC algorithm in
collage
subcommandBREAKING CHANGE: drop support for Python 3.5
format code with
black
0.13.0 (2020-10-26)
quad
subcommand to to collect four images into a quadimprove documentation
0.12.0 (2020-07-24)
flip
subcommand to flip/mirror images left-rightMonkey patch
IFDRational.__eq__
method of Pillow in tests to avoid regression with Pillow 7.2.0
0.11.1 (2020-04-05)
-x/--seed
option for collage to control initialization of random number generator
0.11.0 (2020-03-21)
collage subcommand for creating a framed collage from images
BREAKING CHANGE: default method for colorfix is now quantiles-fixed-cutoff
preserve xmp metadata when
-e/--preserve-exif
is used (in addition to exif metadata)
0.10.0 (2020-03-04)
-m/--method
option to colorfix (default: quantiles)add fixed-cutoff as new method to colorfix accepting fixed colors as color cutoff boundaries
add quantiles-fixed-cutoff as new method to colorfix combining quantiles and fixed-cutoff
deprecate running colorfix without specifying method (as default will change in next version)
0.9.0 (2020-02-19)
add numpy as dependency
change colorfix algorithm to vectorized numpy code for performance
support Python 3.8
0.8.1 (2020-01-12)
fix crash when orientation is missing in exif headers
0.8.0 (2019-07-10)
dither subcommand for dithering
filmstrip subcommand to stack images horizontally
images can be saved in PNG format using
--png
CLI flag
0.7.1 (2019-05-16)
fix development status
0.7.0 (2019-05-16)
option for preserving exif image metadata
fix error when running with
-k/--keep-names
status progress to Alpha
0.6.0 (2019-03-14)
framecrop subcommand to crop and frame an image to a target aspect ratio incl. tests and docs
breaking change: moved command modules to commands package
introduced ImageInfo as a container for additional meta information in the pipeline
increased test coverage
more documentation
0.5.2 (2019-03-10)
use a custom parameter type for colors
0.5.1 (2019-03-09)
changed default frame width to 0.025
usage doc for frame subcommand
consistent alphabetic sorting of subcommands
use a custom parameter type for ratios
0.5.0 (2019-03-07)
blackwhite subcommand to convert color images to black and white; incl. doc
frame subcommand to put a monocolor frame around images; incl. tests
0.4.0 (2019-02-26)
convert RGBA mode PNG images to RGB (to enable saving as JPG)
crop subcommand to crop images to a specified aspect ratio
documentation for colorfix and crop
0.3.0 (2019-02-17)
-d/--digits
option to specify number of digits in file names-c/--increment
option to define increment for file numberingcreate non-existing output folder instead of complaining
0.2.0 (2019-01-30)
no-op save command for only saving images
raise exception if output image already exists
-f/--force-overwrite
flag to enable overwriting outputtests for cli, pipeline and resize
0.1.1 (2019-01-29)
Fix __main__ module
0.1.0 (2019-01-29)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file imgwrench-0.17.0.tar.gz
.
File metadata
- Download URL: imgwrench-0.17.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e5f1c1a26e0d55a8dd8e545b3820560f2866b96973eb216c458247c95ed97b2 |
|
MD5 | 7119bf9bea4ceed1f634ab1f83a03a86 |
|
BLAKE2b-256 | e78060041f3fe53ee10eabe7e0f5b17454335bfee16bef19ef97f197b192f5e7 |
File details
Details for the file imgwrench-0.17.0-py2.py3-none-any.whl
.
File metadata
- Download URL: imgwrench-0.17.0-py2.py3-none-any.whl
- Upload date:
- Size: 98.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 690cfb8303357752db9742a87c3a437f6ddd6c3a25d943a83e7f52f32e8b9b7f |
|
MD5 | 2423f04297ba5eb43d509ba6ff067e6f |
|
BLAKE2b-256 | 2ad59088e9f84eaca079b9ced67b1e35b1b74d1bc810e432dd150b90606ce981 |