Skip to content

Make images look as if they are made out of 1x1 LEGO blocks

License

Notifications You must be signed in to change notification settings

glancashire/Legofy

 
 

Repository files navigation

Legofy Build Status Coverage Status Code Health Join the chat at https://gitter.im/JuanPotato/Legofy

What is it?

Legofy is a python program that takes a static image or gif and makes it so that it looks as if it was built out of LEGO.

Before

After

Requirements

  • Python
  • Python modules: Pillow, click
  • imagemagick

Bugs

If you find a bug:

  1. Check in the open issues if the bug already exists.
  2. If the bug is not there, create a new issue with clear steps on how to reproduce it.

Quickstart

$ git clone https://github.com/JuanPotato/Legofy.git
$ cd Legofy
$ python setup.py install
$ legofy image.jpg # anywhere

Wait! I don't know what any of this means? Detailed instructions

Usage

Usage: legofy [OPTIONS] IMAGE [OUTPUT]

  Legofy an image!

Options:
  --size INTEGER                  Number of bricks the longest side of the legofied image should have.
  --dither / --no-dither          Use dither algorithm to spread the color approximation error.
  --palette [all|effects|mono|solid|transparent]
                                  Palette to use based on real Lego colors.
  --help                          Show this message and exit.

Palette

There are 3 palettes: solid (33 colors), transparent (14 colors) and effects (4 colors). You can use one of them or all the 3.

$ legofy --palette solid image.jpg
$ legofy --palette transparent image.jpg
$ legofy --palette effects image.jpg
$ legofy --palette all image.jpg

There is another one palette, mono, with only 2 colors (black and white...). It's just for test and fun...

Troubleshooting

Mac

  • ValueError: --enable-zlib requested but zlib not found, aborting.
    • try xcode-select --install in the terminal
  • ValueError: --enable-jpeg requested but jpeg not found, aborting.
  • Incompatible library version: libtiff.X requires version X or later, but libjpeg.X provides version X
    • Follow instructions here

Installation

  1. Download and install all requirements
  1. Download this project by using the download zip button on this page, or running git clone https://github.com/JuanPotato/Legofy
  • If you downloaded a zip file, please unzip it
  1. Open a command line and navigate to the project folder
  2. Run python setup.py install while in the project folder
  3. You can now use Legofy anywhere, see usage for more help

About

Make images look as if they are made out of 1x1 LEGO blocks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%