Coder Social home page Coder Social logo

mosaic's Introduction

Mosaic Image Generator

Automated generation of mosaic images from a set of images.

Installation/Preparation

Python 3 is required.

  1. Clone the repository.
  2. Install dependencies by running python3 -m pip install -r requirements.txt inside the repo.
  3. Get a huge amount of images and put them in one single folder.

For the default settings 1024 images will be used. So to get any result with default settings at least that many images are required. For a good result a few times as many are recommended. Also the diversity of colors in the images has a big impact on the result. (Representing yellow pixels is hard if you don't have yellowish images in your dataset.)

Usage

Running python3 mosaic.py --help will get you the following help text:

usage: mosaic.py [-h] [-w WIDTH] [-n NUMBER] [-o OUT_PIC] src_dir src_pic

Mosaic Image Generator v1.1

positional arguments:
  src_dir               directory with a lot of images
  src_pic               the image that will be recreated with small images

optional arguments:
  -h, --help            show this help message and exit
  -w WIDTH, --width WIDTH
                        the width of individual images of the mosaic in pixels
                        (default: 256)
  -n NUMBER, --number NUMBER
                        number of images per row of the mosaic (default: 32)
  -o OUT_PIC, --out_pic OUT_PIC
                        the path of the generated mosaic (default:
                        '[src_pic]_{n}x{w}.jpg')

You need at least width² images in the src_dir directory. Only png and jpg images will be used.

TODO

  • make calculation of average colors async or multithreaded
  • fit subpixels in the small images to subpixels in the target image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.