12 releases (4 breaking)
0.6.3 | Feb 1, 2025 |
---|---|
0.6.2 | Feb 1, 2025 |
0.6.1 | Jan 26, 2025 |
0.5.0 | Jan 25, 2025 |
0.2.3 | Oct 21, 2024 |
#113 in Images
4MB
2K
SLoC
Easy photo mosaics
Make your own photo mosaics here!
Prefer python? Check out
loiccoyle/phomo
!
This repo contains two crates:
phomo
crate contains the photo mosaic generation library.phomo-cli
crate provides the command line interface to thephomo
crate.
And one npm
package:
phomo-wasm
provides thewasm
bindings and allowsphomo
to be used in the browser.
📦 Installation
Command line
Cargo
To use the phomo
binary to build photo mosaics, install the phomo-cli
crate:
cargo install phomo-cli
Arch linux (AUR)
Using your favourite AUR helper, install the phomo-git
package:
paru -S phomo-git
Usage
Once installed, you can use the phomo
binary.
Something like:
phomo master_image.png tile_directory/ output_mosaic.png
If doubt see the help:
$ phomo -h
Usage: phomo [OPTIONS] <MASTER_FILE> <TILE_DIR> <OUTPUT>
Arguments:
<MASTER_FILE> Master image
<TILE_DIR> Tile directory
<OUTPUT> Output mosaic file
Options:
-g, --grid-size <WIDTH,HEIGHT> Grid size, the number of tiles along the width and height
-n, --n-appearances <N_APPEARANCES> The number of times a tile can appear in the mosaic [default: 1]
--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
--solver <SOLVER> The solver to use to compute the tile to cell assignments [default: hungarian] [possible values: greedy, auction, hungarian]
--metric <METRIC> The distance metric to use [default: norm-l1] [possible values: norm-l1, norm-l2, avg-color, luminance-l1, luminance-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:
cargo add phomo
See the docs for usage.
Wasm
To use the wasm
bindings in your project, add the phomo-wasm
npm
package:
npm add phomo-wasm
I would recommend taking a look at the demo page's source code.
Dependencies
~8–16MB
~204K SLoC