Skip to main content

Mosayc

PyPI Status Build Status Documentation Status License: MIT Code Coverage

Mosayc turns a main picture into a mosaic of smaller pictures.

Story

A few years ago, I wanted to make a special gift for the birthday of my partner. A friend suggested to build a photo wall, but I recalled then that she liked jigsaws... So what about a personalized jigsaw?

A fake Picasso made of Kandinski's

The gift was appreciated! And a few years later, I decided to release the code I used. Enjoy!

Features

There are already many tutorials to build a mosaic from a bunch of tile pictures, e.g. here or there (this is far from being exhaustive).

So... what makes Mosayc different? Mostly its use case: make a personalized memory-lane that you can offer as a gift (print as a poster, a jigsaw puzzle, use as screensaver of background...).

  • All proposals I found so far are based on finding the closest tile for each mixel (mosaic pixel). As a result, most of the time, you just use a small subset of your tiles (the ones with the good colors) that you copy many times. And you still have no guarantee that the colors will be right in the hand. In contrast:
    • Mosayc leverages $b$-matching theory, a technique that ensures that all your tiles will occupy roughly the same number of mixels (and you control the redundancy): all your pictures will be included!
    • Mosayc can adjust the color of your tiles so they correspond to what you want (and you control the adjustment).
    • Mosayc can have tiles of different aspect ratios and orientations.
    • Mosayc can tilt the tiles so the result looks a bit homemade.
  • It's packaged with a nice CLI, so you can make mosaics without worrying about the computation.

Quickstart

Install Mosayc:

$ pip install mosayc

Use Mosayc in a Python project:

>>> from mosayc import Mosayc
>>> mosayc = Mosayc(input='mypicture.jpeg', tiles_dir='mydir')
>>> img = mosayc.compute()

Use the resulting Pillow image as you want!

Use Mosayc CLI:

CLI help:

$ mosayc --help

Example:

$ mosayc -I myipcture.jpeg -D mydir -O mymosaic.jpeg

Credits

This package was created with Cookiecutter and the Package Helper 3 project template.

Metadata

Release files for mosayc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mosayc 0.1.0
File Size Uploaded
mosayc-0.1.0.tar.gz 12.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for mosayc 0.1.0
File Interpreter ABI Platform
mosayc-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 MB

Release files / mosayc-0.1.0.tar.gz

Download URL mosayc-0.1.0.tar.gz
Size 12.4 MB
Tags Source
SHA-256 checksum
How to use checksums
dcc0ad9d8fb648c45e55639e88b66bcc374ac0f3257850982e35bf32e9ad59c4
BLAKE2b-256 checksum
How to use checksums
e1729933398c03f3352bccb6de397d3eb8098e820a1fb785559acc1c4d338245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.2

Release files / mosayc-0.1.0-py3-none-any.whl

Download URL mosayc-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddea5eecfa7a34170bb50744cf351ddbe8b4eddbf873c1e4b4d95b620fe3219a
BLAKE2b-256 checksum
How to use checksums
b1999f065439bf571b3d826905a3c9fd014b048b771ac70c20cf65466fd072b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page