Skip to content

This repository contains python scripts that converts any image into a mosaic representation.

License

Notifications You must be signed in to change notification settings

JavierCoronel/mosaic_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mosaic Image Generator

This repository contains Python code to convert any image into an artistic mosaic representation. It is based on previous work from yobeatz.

Original Image Generated Mosaic

Implementation Details

The project uses the following steps to convert an image into a mosaic:

  1. Read and process and image.
  2. Extract the edges of the image using AI or classical edge extraction methods.
  3. Derive guidelines to place polygons that will serve as the tiles of the mosaic.
  4. Apply color for each tile based on the original image.
  5. Plot and save the mosaic.

Installation

  1. Get the code. You can clone the repository by opening a terminal in your desired folder and using:
    git clone https://github.com/JavierCoronel/mosaic_generator.git
    
    Alternatively, you can download a zip file with the contents of this repository with this link. Unzip the file in your desired folder.
  2. Install the requirements: You will need Python 3.10. Install the required packages by opening a terminal in the mosaic_generator folder, then use:
    pip install -r requirements.txt
    

Usage

Generate one mosaic with defined parameters

To generate a mosaic have a look at the following steps:

  1. Create your configuration parameters. You should prepare a configuration file that lists the parameters you want to use for creating a mosaic. Check out the configuration parameters to understand and select the values that suit your specific requirements.
  2. Run the code to generate the mosaic: In a terminal window, execute the main script as follows:
    python main.py --config-name=config_name
    
  3. Inspect your mosaic: In the output folder you specified, you will find a subfolder named with the date of code execution. This allows for running the code multiple times with different parameters for a same image. Inside each folder you will find the following files:
    • The mosaic saved as an image.
    • The YAML file with the parameters you used for this mosaic.
    • A log file capturing all the information during code execution.

Contributions

Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

This repository contains python scripts that converts any image into a mosaic representation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages