Code Monkey home page Code Monkey logo

image-mosaic's Introduction

image-mosaic

A Image Mosaic generator made with Python

Getting Started

To get up and running, make sure you have Python installed

Prerequisites

This project depends on Numpy , Pillow and scikit-image

to install them:

Numpy:

pip install numpy

Pillow:

pip install pillow

scikit-image

pip install scikit-image

User Defined Variables

In the code, there are variables that can be changed

  1. The name of the input image -> 'mainImageTarget'

  2. Number of tiles to devide image into -> 'numberOfTiles'.

    • For square image you can input 1 number equal to the number of tiles (must be squared number)
    • For non squared images, you input the number of square on x axis, and number of squares on y axis
  3. Comparison Mode ->

    • [1] Compare transformed rgb to transformed rgb (small tiles)
    • [2] Compare transformed rgb to transformed rgb (big tiles)
  4. Transform Mode ->

    • [1] no transformation
    • [2] RGB -> sRGB
    • [3] RGB -> CIE-Lab (my implimentation)
    • [4] RGB -> CIE-Lab (scikit-image)

As of the latest version, this is not required, refer to command line usage. However, if you wish to use it the old way, look for this piece of code.

#& user defined if need be. 
mode = args['mode']						#1
transform = args['transform']			#3
numberOfTiles = args['tiles']			#400
mainImageTarget = args['file']			#"1_in.jpg"
#&

Command-Line Usage

To use the script you need to attached arguments in the command-line,

Refer to above (User Defined Variables) for explination on values,

  • [-m] mode := comparison mode, is int of range [1 -> 2]
  • [-t] tiles := number of tiles, explained in last section.
  • [-tr] or [-trans] transform mode := transformation from RGB to ... , is int of range [1 -> 4]
  • [-f] file := target file, is the filename of the image.

Example usage

#For square image, 400 tiles (20x20)
$	sudo python python_image_mosaic.py -m 1 -t 200 -tr 3 -f 1_in.jpg

#For non-square image, 3750 tiles (50x75)
$	sudo python python_image_mosaic.py -m 1 -t 50, 75 -tr 3 -f 2_in.jpg

Example Output

Target Image Resulting Image

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Imran Paruk - Initial work

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Thank you to:

image-mosaic's People

Contributors

imranparuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.