Skip to main content

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, .tif formats
  • Optional verbose mode with progress bars using tqdm
  • Reuse preloaded tiles with TileManager for multiple mosaics
  • Easy-to-use Python API
  • Compatible with Python 3.10+

Installation

Install PytoMosaic from PyPI:

pip install pytomosaic

Dependencies:

  • numpy
  • Pillow
  • tqdm

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)
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytomosaic-0.1.9.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytomosaic-0.1.9-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file pytomosaic-0.1.9.tar.gz.

File metadata

  • Download URL: pytomosaic-0.1.9.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

Hashes for pytomosaic-0.1.9.tar.gz
Algorithm Hash digest
SHA256 8ac2452fa014488225165fbf82dcd536085291cd230a0643a22fa7fabdc70aa6
MD5 17f09ff8367ec15e909688c6ee63b681
BLAKE2b-256 93840b80576cc2cab6ee43c06853f05f7864084c2ea13068d93d598ba111c293

See more details on using hashes here.

File details

Details for the file pytomosaic-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: pytomosaic-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for pytomosaic-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f053de443d9fe1feca64afc7cecffbe15dd4c93ab2e8a5f94081ca568a92d700
MD5 3ae58873e21347876e9b2559e93c99b3
BLAKE2b-256 be09400b3e05b2b0ae12800153b426db7d2c8e828a22d661a649c7d52f41a5fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page