Skip to content
Snippets Groups Projects
README.md 2.59 KiB
Newer Older
Louis's avatar
Louis committed
# Crunch

Command line image manipulation, set up a pipeline once and run it against all of your assets

Louis's avatar
Louis committed
For more info, check out [the docs](https://microhacks.lcr.app/crunch)

Louis's avatar
Louis committed
## Usage

Louis's avatar
Louis committed
Crunch takes an image and applies a transformation to it. But what if you want to do **two** transformations?
Or transform more than one image at a time?

Pipelines!
Louis's avatar
Louis committed

Louis's avatar
Louis committed
The main value of Crunch is reproducible image processing, as defined by a [pipeline toml]() file.
Louis's avatar
Louis committed

Louis's avatar
Louis committed
Basic CLI usage:
Louis's avatar
Louis committed

Louis's avatar
Louis committed
```shell
Louis's avatar
Louis committed
Command line asset manipulation, set up a pipeline once and run it against all of your files

Usage: crunch <COMMAND>

Commands:
Louis's avatar
Louis committed
  atlas     Given a set of image files, create a single atlas image and metadata file containing all of the image data
Louis's avatar
Louis committed
  rotate    Rotate an image clockwise by the given degree
  extrude   Take each tile in an image and expand its borders by a given amount. Optionally fill with nearby pixels instead of empty space
  palette   Create a palette file containing every distinct colour from the input image
  scale     Resize an image by a scale factor
  flip      Flip an image along one or more axis
  remap     Convert the colour space of an image to that of a given palette file
  pipeline  Execute a predefined pipeline
  reduce    Limit the number of colours by quantity or threshold
  split     Take a spritesheet and split into individual sprites, skipping empty space
Louis's avatar
Louis committed
  extract   Extract individual, non-square sprites from a given spritesheet
  info      Extract Information About An Image into a JSON file
Louis's avatar
Louis committed
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
Louis's avatar
Louis committed
```
Louis's avatar
Louis committed
- [Latest Linux Version](https://lab.lcr.gr/microhacks/crunch/-/jobs/artifacts/trunk/raw/target/release/crunch?job=build-linux)
Louis's avatar
Louis committed
- [Latest Windows Version](https://lab.lcr.gr/microhacks/crunch/-/jobs/artifacts/trunk/raw/target/x86_64-pc-windows-gnu/release/crunch.exe?job=build-windows)

## Build From Source

You can simply download this repository and run `cargo build --release` to get a binary for your system. Using `--release` mode
is required in all situations, as the time taken to run a command with the debug build is _several_ orders of magnitude higher.

If you use the `.local/bin` pattern for non-sudo userspace programs, you can use the included build script to simplify things. Otherwise,
follow the below instructions:

**Simple Script**
- Clone this repository
- Run `sh source-install.sh`

**Manual**
- Clone this repository
- Run `cargo build --release`
- Optionally, `strip` the binary
Louis's avatar
Louis committed
- Copy `target/release/crunch` to a folder located in your `$PATH`