{"id":19686131,"url":"https://github.com/loiccoyle/phomo","last_synced_at":"2025-04-29T06:31:22.143Z","repository":{"id":43220932,"uuid":"227450617","full_name":"loiccoyle/phomo","owner":"loiccoyle","description":"📷 Python package and CLI utility to create photo mosaics - now with GPU support","archived":false,"fork":false,"pushed_at":"2025-01-21T11:43:42.000Z","size":195989,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T07:41:14.013Z","etag":null,"topics":["image-processing","images","mosaic","photomosaic","python"],"latest_commit_sha":null,"homepage":"http://docs.loiccoyle.com/phomo/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loiccoyle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-11T20:07:11.000Z","updated_at":"2025-03-10T09:00:25.000Z","dependencies_parsed_at":"2023-01-29T22:01:15.189Z","dependency_job_id":"ad9e5b6b-60f6-417a-8bb8-d363d4b78629","html_url":"https://github.com/loiccoyle/phomo","commit_stats":{"total_commits":124,"total_committers":5,"mean_commits":24.8,"dds":0.07258064516129037,"last_synced_commit":"494eeba2f800d49136d8cbd817c8f78fcdd9d6da"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fphomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fphomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fphomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fphomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loiccoyle","download_url":"https://codeload.github.com/loiccoyle/phomo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251450656,"owners_count":21591407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","images","mosaic","photomosaic","python"],"created_at":"2024-11-11T18:26:17.281Z","updated_at":"2025-04-29T06:31:17.128Z","avatar_url":"https://github.com/loiccoyle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.imgur.com/rMze8u5.png\" width=\"1000\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cb\u003ePython package and CLI utility to create photo mosaics.\u003c/b\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/loiccoyle/phomo/actions\"\u003e\u003cimg src=\"https://github.com/loiccoyle/phomo/actions/workflows/ci.yml/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://loiccoyle.com/phomo\"\u003e\u003cimg src=\"https://img.shields.io/github/deployments/loiccoyle/phomo/github-pages?label=docs\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/phomo/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/phomo\"\u003e\u003c/a\u003e\n  \u003ca href=\"./LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/platform-linux%20%7C%20macOS%20%7C%20windows-informational\"\u003e\n\u003c/p\u003e\n\n\u003e Prefer rust? Or a `npm` package? Check out [`loiccoyle/phomo-rs`](https://github.com/loiccoyle/phomo-rs)!\n\n`phomo` lets you create [photographic mosaics](https://en.wikipedia.org/wiki/Photographic_mosaic).\nIt arranges the tile images to best recreate a master image. To achieve this, `phomo` computes a distance matrix between all the tiles and the master image regions, looking not just at the average colour but the norm of the colour distributions differences.\nOnce this distance matrix is computed, each tile is assigned to the optimal master image region by solving the linear sum assignment problem.\n\n## 📦 Installation\n\nIn a terminal:\n\n```sh\npip install phomo\n\n# or for GPU acceleration:\n\npip install 'phomo[cuda]'\n```\n\nAs always, it is usually a good idea to use a [virtual environment](https://docs.python.org/3/library/venv.html).\n\nIf you're just interested in command line usage, consider using [pipx](https://pypa.github.io/pipx/).\n\n\u003e [!NOTE]\n\u003e For GPU acceleration you'll need a CUDA compatible GPU and the CUDA toolkit installed. See [numba docs](https://numba.readthedocs.io/en/stable/cuda/overview.html#requirements) for details.\n\n## 📋 Usage\n\n### Python package\n\nCheck out the [docs](https://loiccoyle.com/phomo) and the [`examples`](./examples).\n\n### CLI\n\nOnce it is installed, you can use the `phomo` command.\n\nIt would go something like:\n\n```sh\nphomo master.png tile_directory/ -S 20 20 -o mosaic.png\n```\n\nIf in doubt see the help:\n\n\u003c!-- help start --\u003e\n\n```console\n$ phomo -h\nusage: phomo [-h] [-o OUTPUT] [-c MASTER_CROP_RATIO]\n             [-s MASTER_SIZE [MASTER_SIZE ...]] [-C TILE_CROP_RATIO]\n             [-S TILE_SIZE [TILE_SIZE ...]] [-n N_APPEARANCES] [-b] [-g]\n             [-d SUBDIVISIONS [SUBDIVISIONS ...]] [-G]\n             [-m {greyscale,norm,luv_approx}] [-j WORKERS] [-e]\n             [--match-master-to-tiles] [--match-tiles-to-master] [-v]\n             master tile_dir\n\npositional arguments:\n  master                Master image path.\n  tile_dir              Directory containing the tile images.\n\noptions:\n  -h, --help            show this help message and exit\n  -o OUTPUT, --output OUTPUT\n                        Mosiac output path.\n  -c MASTER_CROP_RATIO, --master-crop-ratio MASTER_CROP_RATIO\n                        Crop the master image to width/height ratio.\n  -s MASTER_SIZE [MASTER_SIZE ...], --master-size MASTER_SIZE [MASTER_SIZE ...]\n                        Resize master image to width, height.\n  -C TILE_CROP_RATIO, --tile-crop-ratio TILE_CROP_RATIO\n                        Crop the tile images to width/height ratio.\n  -S TILE_SIZE [TILE_SIZE ...], --tile-size TILE_SIZE [TILE_SIZE ...]\n                        Resize tile images to width, height.\n  -n N_APPEARANCES, --n-appearances N_APPEARANCES\n                        The number of times a tile can appear in the mosaic.\n  -b, --black-and-white\n                        Convert master and tile images to black and white.\n  -g, --show-grid       Show the tile grid, don't build the mosiac.\n  -d SUBDIVISIONS [SUBDIVISIONS ...], --subdivisions SUBDIVISIONS [SUBDIVISIONS ...]\n                        Grid subdivision thresholds.\n  -G, --gpu             Use GPU for distance matrix computation. Requires\n                        installing with `pip install 'phomo[cuda]'`.\n  -m {greyscale,norm,luv_approx}, --metric {greyscale,norm,luv_approx}\n                        Distance metric.\n  -j WORKERS, --workers WORKERS\n                        Number of workers use to run when computing the\n                        distance matrix.\n  -e, --equalize        Equalize the colour distributions to cover the full\n                        colour space.\n  --match-master-to-tiles\n                        Match the master image's colour distribution with the\n                        tile image colours.\n  --match-tiles-to-master\n                        Match the tile images' colour distribution with the\n                        master image colours.\n  -v, --verbose         Verbosity.\n```\n\n\u003c!-- help end --\u003e\n\n## 🤩 Credit\n\n- [photomosaic](https://pypi.org/project/photomosaic/) for the grid subdivision feature.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floiccoyle%2Fphomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floiccoyle%2Fphomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floiccoyle%2Fphomo/lists"}