An Open Source Python library for creating photomosaics
Project description
PytoMosaic
PytoMosaic is a Python library for creating photomosaics from images using a set of source images. It supports common image formats and provides a simple API with optional verbose progress output. It also allows reusing preloaded tiles for faster mosaic generation across multiple images.
Features
- Create photomosaics from images
- Supports
.jpg,.jpeg,.png,.gif,.bmp,.tiff,.tifformats - Optional
verbosemode with progress bars usingtqdm - Reuse preloaded tiles with
TileManagerfor multiple mosaics - Easy-to-use Python API
- Compatible with Python 3.10+
- Ability to save files
Installation
Install PytoMosaic from PyPI:
pip install pytomosaic
Dependencies:
numpyPillowtqdm
These will be installed automatically.
Usage
Basic usage
from pytomosaic import createMosaic
imgPath = "target.jpg"
sourceImages = "source_folder"
cropSize = 50 # Size of mosaic parts in px
# Generate mosaic with verbose progress
mosaic = createMosaic(imgPath, sourceImages, cropSize, verbose=True, savePath="example.jpg")
mosaic.show()
Reusing preloaded tiles for multiple images
from pytomosaic import createMosaic
from pytomosaic.tileManager import TileManager
# Preload tiles once
tiles = TileManager(cropSize=50, sourceImagesDir="source_folder", verbose=True)
# Generate multiple mosaics using the same tiles
mosaic1 = createMosaic("photo1.jpg", tiles)
mosaic2 = createMosaic("photo2.jpg", tiles)
Set verbose=False or leave empty to disable prints and progress bars.
Supported Image Extensions
VALID_EXTENSIONS = {
".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif"
}
Files with unsupported extensions are skipped and optionally warned about in verbose mode.
License
PytoMosaic is licensed under the GNU GPL v3. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytomosaic-0.1.10.tar.gz.
File metadata
- Download URL: pytomosaic-0.1.10.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2578882a67ab921fbb948d933f410b3a90720993185db7446f5ad8302cf33239
|
|
| MD5 |
20c2099fe601ffcfd0e21f534b90f00d
|
|
| BLAKE2b-256 |
0fa492c53ab7405cf7d41a3e197222f5bd0c73402b113d536f515cd84354e7ce
|
File details
Details for the file pytomosaic-0.1.10-py3-none-any.whl.
File metadata
- Download URL: pytomosaic-0.1.10-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a4c13c6fc4cef3568c8047d10d774df4c44954c4a40d1b1b20f1ad8e8bccda5
|
|
| MD5 |
3ef63ff033ca81aaf49796514c13a2d5
|
|
| BLAKE2b-256 |
62281b53452cd3ac2ba619488961aada9e2e42c864a75ae25177c965cc14215f
|