Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/loiccoyle/phomo-rs

📷 Rust library, binary and wasm package to create photo mosaics
https://github.com/loiccoyle/phomo-rs

image-processing mosaic photomosaic rust wasm

Last synced: 2 months ago
JSON representation

📷 Rust library, binary and wasm package to create photo mosaics

Awesome Lists containing this project

README

        


Easy photo mosaics




Make your own photo mosaics here!










> Prefer python? Check out [`loiccoyle/phomo`](https://github.com/loiccoyle/phomo)!

This repo contains two crates:

- `phomo` crate contains the photo mosaic generation library.
- `phomo-cli` crate provides the command line interface to the `phomo` crate.

And one `npm` package:

- `phomo-wasm` provides the `wasm` bindings and allows `phomo` to be used in the browser.

## 📦 Installation

## Command line

### Cargo

To use the `phomo` binary to build photo mosaics, install the `phomo-cli` crate:

```sh
cargo install phomo-cli
```

### Arch linux (AUR)

Using your favourite AUR helper, install the `phomo-git` package:

```sh
paru -S phomo-git
```

### Usage

Once installed, you can use the `phomo` binary.

Something like:

```sh
phomo master_image.png tile_directory/ output_mosaic.png
```

If doubt see the help:

```console
$ phomo -h
Usage: phomo [OPTIONS]

Arguments:
Master image
Tile directory
Output mosaic file

Options:
-g, --grid-size Grid size, the number of tiles along the width and height
--crop-tiles Crop tiles to grid cell size
--resize-tiles Resize tiles to grid cell size
--equalize Equalize the master and tile image color distributions
--transfer-master-to-tiles Transfer the color palette of the master image to the tile images
--transfer-tiles-to-master Transfer the color palette of the tile images to the master image
--metric The distance metric to use [default: norm-l1] [possible values: norm-l1, norm-l2]
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help (see more with '--help')
-V, --version Print version
```

## Library

To use the library as a dependency in your projects, add the `phomo` crate:

```sh
cargo add phomo
```

See the [docs](https://docs.rs/phomo) for usage.

## Wasm

To use the `wasm` bindings in your project, add the `phomo-wasm` `npm` package:

```sh
npm add phomo-wasm
```

I would recommend taking a look at the [demo page's source code](https://github.com/loiccoyle/phomo-rs/tree/gh-pages).