Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.
/ legofy Public archive

Convert an image into a a lego-like image

License

Notifications You must be signed in to change notification settings

roliveira/legofy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

legofy

What is legofy?

It's a simple python function to convert an image into a a lego-like image. It started long ago as a practical exercise to learn some simple Python functionality (e.g. PyPI packaging) but it's now retired in favor of JuanPotato's Legofy.

Usage

A simple example can be generated by using an array with random values:

import numpy
from legofy import legofy
from matplotlib import pyplot

im = numpy.random.rand(10, 10)
im_lego = legofy(im)
_ = pyplot.imshow(im_lego, interpolation='none', origin='lower')

Random

But I want to do it with my profile picture, how can I do it?!

import scipy
from legofy import legofy
from matplotlib import pyplot
import urllib
import cStringIO

url = 'http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/161px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg'
im = misc.imread(cStringIO.StringIO(urllib.urlopen(url).read()))
im = misc.imresize(im, (50, 33), interp='nearest')
im = 1-(255-im)/(255)
im_lego = legofy(im)
_ = pyplot.imshow(im_lego, interpolation='none', origin='lower')

Monalisa

License information

See the file LICENSE for information on this software, terms & conditions for usage and a disclaimer of all warranties.

About

Convert an image into a a lego-like image

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published