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.
To use the phomo
binary to build photo mosaics, install the phomo-cli
crate:
cargo install phomo-cli
Using your favourite AUR helper, install the phomo-git
package:
paru -S phomo-git
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
--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 <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
To use the library as a dependency in your projects, add the phomo
crate:
cargo add phomo
See the docs for usage.
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.