https://github.com/mlange-42/print-prep
Command line tool for photo print preparation, written in Rust
https://github.com/mlange-42/print-prep
image-processing photo photography printing
Last synced: 4 months ago
JSON representation
Command line tool for photo print preparation, written in Rust
- Host: GitHub
- URL: https://github.com/mlange-42/print-prep
- Owner: mlange-42
- License: mit
- Created: 2020-04-22T19:53:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-28T22:47:18.000Z (over 5 years ago)
- Last Synced: 2025-06-13T19:05:19.018Z (4 months ago)
- Topics: image-processing, photo, photography, printing
- Language: Rust
- Homepage: https://mlange-42.github.io/print-prep/
- Size: 928 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# print-prep
[](https://travis-ci.com/mlange-42/print-prep)
Command line tool for preparing photos for printing, and other bulk image operations.
* **[Download binaries](https://github.com/mlange-42/print-prep/releases/)**
* [Sources on GitHub](https://github.com/mlange-42/print-prep)**Content**
* [Features](#features)
* [Installation](#installation)
* [Getting started](#getting-started)
* [Examples](#examples)
* [Commands](#commands)
* [Library / crate](#library--crate)
* [License](#license)## Features
* Bulk image processing from the command line (Linux, Windows, OSX)
* Bulk-prepare images for printing, with:
* Exactly predictable size and resolution,
* Cut marks and 'mat' framing,
* EXIF information (date, camera settings, GPS, ...),
* Print control element
* Convenient syntax with arbitrary mixing of length units (*cm*, *mm*, *in*, *px*)
* Automatically determines exact sizes for approximate *cm* formats (e.g., 10x15 is actually *10.2 cm x 15.2 cm*)
* More image processing operations to come...## Installation
* Download the [latest binaries](https://github.com/mlange-42/print-prep/releases/).
* Unzip somewhere with write privileges (only required for running examples in place).## Getting started
* See section [Examples](#examples) below, and try the batch files in sub-directory [/cmd_examples](https://github.com/mlange-42/print-prep/tree/master/cmd_examples).
* For a full list of options, see section [Commands](#commands) or run `pprep -h`. Run `pprep --help` for a more comprehensive help message.
* Run `pprep -h` or `pprep --help` for information on a particular command.## Examples
A simple example for preparing prints with 'mats' (padding) and cut marks:
```
pprep ^
--input "test_data/*.jpg" ^
--cmd ^
prep ^
--output "test_data/out/*-marks.png" ^
--format 10cm/15cm ^
--padding 5mm ^
--margins 5mm ^
--cut-marks ./1mm ^
--dpi 90
```> _Note 1:_ The ^ at the end of each line is required for breaking commands into multiple lines (at least on Windows).
> _Note 2:_ On Unix systems, the input pattern(s), as well as the output pattern with placeholder * **MUST be quoted**!.
Resulting in something like this:

_Simple print preparation example._Further, we can add a print control element and some EXIF information to the image:
```
..\target\release\pprep ^
--input "../test_data/*.jpg" ^
--cmd ^
prep ^
--output "../test_data/out/*-exif.png" ^
--format 10cm/15cm ^
--padding 5mm ^
--margins 5mm ^
--cut-marks ./1mm ^
--exif "{F/2}, {Exp}, ISO {ISO}, {F}" ^
--test-pattern 15px/3px ^
--dpi 150
```Note the two new lines above `--dpi 150`! We get this:

_Print preparation example with EXIF info and control element._## Commands
Common options of all sub-commands are listed here.
For options of specific subcommands, see:**[`prep`](#prep) [`scale`](#scale) [`list`](#list)**
Common options:
```
Command-line tool for photo print preparation and other bulk image operations.Use `pprep -h` for help, or
`pprep --help` for more detailed help, or
`pprep -h` for help on an operation.For more documentation, see the GitHub repository:
https://mlange-42.github.io/print-prep/USAGE:
pprep [FLAGS] [OPTIONS]FLAGS:
-c, --cmd Dummy option to end the `--input` list when no other top-level options are used.
-d, --debug Debug print parsed command line options
-h, --help Prints help information
-V, --version Prints version information
-w, --wait Wait for user input after processingOPTIONS:
-i, --input ... List of input files or patterns. On Unix systems, patterns MUST be quoted!
-t, --threads Number of threads for parallel processing. Optional, default: number of processorsSUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
list List files found by input pattern
prep Prepare images for printing (add cut marks, 'mats', test patterns, EXIF information, ...).
scale Scale images to absolute or relative size
```### `prep`
```
Prepare images for printing (add cut marks, 'mats', test patterns, EXIF information, ...).
________________________________________
| | | |
| | | |----- format
|---- ------------------------------ ----|
| | ____________________ |----|----- framed-size
| | | | | |
| | | |----|----|----- image-size
| | | | | | border
| | | | | |
| | | | -|----|----- padding
| | | | | |
| | | | | -|----- margins
| | |____________________| | |
| | |----|----- cut-frame
|---- ------------------------------ ----|
| | |----|----- cut-marks
|____|______________________________|____|USAGE:
pprep prep [FLAGS] [OPTIONS] --format --outputFLAGS:
-h, --help Prints help information
--incremental Enable incremental scaling. For scaling to small sizes, scales down in multiple steps, to 50%
per step, averaging over 2x2 pixels
--no-rotation Prevents rotation of portrait format images (or of landscape format images if `--format` is
portrait)
-V, --version Prints version informationOPTIONS:
-b, --bg Background color. Default `white`
--border Border width around image. Default none. This is included in padding!
--border-color Border color. Default black
--color Cut marks, frame and exif color. Default: black
--cut-frame Cut frame. Format /. Use alternative to `--cut-marks`
--cut-marks Cut marks with offset. Format /. Use alternative to `--cut-
frame`
-d, --dpi Image resolution. Default `300`
--exif Prints exif data. Formatting string. Example: --exif "{F/2}, {Exp}, ISO {ISO},
{F}" Common abbreviations: `F/2`, `Exp`, `ISO`, `F`, `Bias`, `Date`, `Mod`.
Further, all official exif tags
--exif-size Size of exif font, in arbitrary units. Default: `12px`
-f, --filter Filter type for image scaling. One of `(nearest|linear|cubic|gauss|lanczos)`.
Default: `cubic`
--format Print format `width/height`. Formats in cm are converted to exact print formats
in inches. Examples: `15cm/10cm`, `6in/4in`, `6000px/4000px`
--framed-size Maximum image size, incl. padding
--image-size Maximum image size, excl. padding
--margins Minimum margins around cut marks
-o, --output Output path. Use `*` as placeholder for the original base file name.
Used to determine output image type. On Unix systems, this MUST be quoted!
--padding Padding between image and cut marks
-q, --quality Image quality for JPEG output in percent. Optional, default `95`
--test-pattern Prints a print control element, with the given square size and gap. Format:
`///` or `/`. Example: `10px/2px/10px/2px`
```### `scale`
```
Scale images to absolute or relative sizeUSAGE:
pprep scale [FLAGS] [OPTIONS] --outputFLAGS:
-h, --help Prints help information
--incremental Enable incremental scaling. For scaling to small sizes, scales down in multiple steps, to 50%
per step, averaging over 2x2 pixels
-V, --version Prints version informationOPTIONS:
-b, --bg Background color for `--mode fill`. Default `white`
-d, --dpi Image resolution for size not in px. Default `300`
-f, --filter Filter type for image scaling. One of `(nearest|linear|cubic|gauss|lanczos)`. Default:
`cubic`
-m, --mode Scaling mode. Must be given when using `--size` with width and height. One of
`(keep|stretch|crop|fill)`. Default: `keep`
-o, --output Output path. Use `*` as placeholder for the original base file name.
Used to determine output image type. On Unix systems, this MUST be quoted!
-q, --quality Image quality for JPEG output in percent. Optional, default `95`
--scale Output image scale. Use either `--size` or `--scale`. Examples: `0.5`, `50%`, `20%/10%`
--size Output image size. Use either `--size` or `--scale`. Examples: `100px/.`, `./15cm`,
`8in/6in`
```### `list`
```
List files found by input patternUSAGE:
pprep list [FLAGS]FLAGS:
-a, --absolute Prints the absolute path
-h, --help Prints help information
-p, --path Prints the full path
-V, --version Prints version information
```## Library / crate
To use this crate as a rust library, add the following to your `Cargo.toml` dependencies section:
```
print-prep = { git = "https://github.com/mlange-42/print-prep.git" }
```_Warning:_ The API is still incomplete and highly unstable, so be prepared for frequent changes.
Any help to stabilize the API is highly appreciated.For the latest development version, see branch [`dev`](https://github.com/mlange-42/print-prep/tree/dev).
## License
[MIT](LICENSE) © M. Lange