An open API service indexing awesome lists of open source software.

https://github.com/rmuraix/pixelate

Command-line image processing app written in Rust
https://github.com/rmuraix/pixelate

image-processing

Last synced: 5 months ago
JSON representation

Command-line image processing app written in Rust

Awesome Lists containing this project

README

          

# Pixelate

[![License](https://img.shields.io/github/license/rmuraix/pixelate)](./LICENSE)
[![Build](https://github.com/rmuraix/pixelate/actions/workflows/build.yml/badge.svg)](https://github.com/rmuraix/pixelate/actions/workflows/build.yml)

## About

Command line applications for image processing

## Usage

Click [here](https://github.com/image-rs/image#supported-image-formats) to see supported image formats.

```bash
Usage: pixelate --input --output

Commands:
grayscale Convert the image to grayscale
halftone Apply halftoning using the dithering method
gamma Perform gamma correction
invert Apply negative-positive inversion
edge Detect edges (e.g., Sobel)
help Print this message or the help of the given subcommand(s)

Options:
-i, --input Path to the image file to be processed
-o, --output Output path for the processed image file
-h, --help Print help
-V, --version Print version
```

### Grayscale

```bash
Usage: pixelate --input --output grayscale [OPTIONS]

Options:
-r, --red Red channel weight [default: 0.2126]
-g, --green Green channel weight [default: 0.7152]
-b, --blue Blue channel weight [default: 0.0722]
-h, --help Print help
```

#### Example

![Grayscale](./assets/parrot_grayscale.jpg)

### Halftone

```bash
Usage: pixelate --input --output halftone

Options:
-h, --help Print help
```

#### Example

Produces black-and-white (grayscale) ordered-dither output.

![Halftone](./assets/parrot_halftone.jpg)

### Gamma

```bash
Usage: pixelate --input --output gamma --gamma

Options:
-g, --gamma Gamma value
-h, --help Print help
```

#### Example

`gamma=0.45`

![Gamma](./assets/parrot_gamma.jpg)

### Invert

```bash
Usage: pixelate --input --output invert

Options:
-h, --help Print help
```

#### Example

![Invert](./assets/parrot_invert.jpg)

### Edge

```bash
Usage: pixelate --input --output edge [OPTIONS]

Options:
--method
Edge detection method

Possible values:
- sobel: Sobel operator (gradient magnitude)

[default: sobel]

--intensity
Intensity multiplier applied after normalization (>= 0.0)

[default: 1.0]

-h, --help
Print help (see a summary with '-h')
```

#### Example

`method=sobel intensity=2.0`

![Edge](./assets/parrot_edge.jpg)

## Development

- Build: `cargo build` (release: `cargo build --release`)
- Test: `cargo test`
- Format: `cargo fmt --all` (CI enforces `-- --check`)
- Lint: `cargo clippy --all-targets --all-features -- -D warnings`

## Library Usage

You can use Pixelate as a library. Example (apply halftone):

```rust
use image::GenericImageView;
use pixelate::filters::{Filter, HalftoneFilter};

let img = image::open("input.jpg")?.to_rgb8();
let out = HalftoneFilter.apply(&img);
out.save("out.jpg")?;
```

## Contributing

Your contribution is always welcome. Please read [Contributing Guide](https://github.com/rmuraix/.github/blob/main/.github/CONTRIBUTING.md).