osaic /

Filename Size Date modified Message
188 B
19 B
2.0 KB
6.2 KB
4 B
1.3 KB


osaic is a simple module which let you create mosaics from images with a simple python -mosaic foo.jpg command.


osaic depends on the PIL library which is going to be installed automatically by the installation script: anyway, in order to make it possible to edit jpeg and png images, please install libjpeg and libpng.


From sources:

cd /path/to/workspace
wget http://pypi.python.org/packages/source/o/osaic/osaic-1.0.0.tar.gz
tar zxvf osaic-1.0.0.tar.gz
cd osaic-1.0.0
python setup.py install

From the PyPI:

pip install osaic


osaic is a module that can be used either as a standalone application or as a standard python library.

Standalone application

A typical usage of the application is to display a mosaic composition created from a source image:

python -mosaic image.jpg

If you want to save the output to a file instead of showing it:

python -mosaic image.jpg -o mosaic-image.jpg

Finally, if you want to create a mosaic which is 4 times bigger than the original image, and with 100 tiles per axis, just issue:

python -mosaic -s4 -t100 image.jpg

For everything else use the help message:

python -mosaic -h


First of all, import the module:

>>> import osaic

Then create a new Osaic object:

>>> mos = osaic.Osaic('foo.jpg', tiles=32, size=1, mode=osaic.DEFAULT)

At this point, create the mosaic, show it on screen and save it on a file:

>>> mos.create()
>>> mos.show()
>>> mos.save('bar.jpg')

Alternatively, you can use the create function shipped with the module which is a wrapper of all the actions listed above:

>>> import osaic
>>> osaic.create(
...     filename='foo.jpg',
...     tiles=32,
...     size=2,
...     mode=osaic.DEFAULT,
...     output=None,
... )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.