Skip to content

joelgrus/posterization-pyladies

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

posterization-pyladies

This is the code for a workshop (slides) I ran for the Seattle Pyladies group in May 2015. In it we implement k-means clustering and use it to "posterize" images.

It requires matplotlib. Apparently, for some people it also requires Pillow if you want it to work with jpg files, I haven't quite figured out under which circumstances that is. :O

The file posterization.py contains stubs for all the methods. The "hints" folder contains hints for writing each one, while the "solution" folder contains my solution (which, it goes without saying, is not the only one).

For instance, if you start with the bee image (from http://commons.wikimedia.org/wiki/File:Polistes_May_2013-2.jpg)

bee

and posterize it to four colors, you get:

bee4

If instead you use eight colors, you get:

bee8

Similarly, if you start with the crayon image (from http://commons.wikimedia.org/wiki/File:Crayons-scent.png)

crayons

and posterize it to four colors, you get:

crayons4

If instead you use eight colors, you get

crayons8

About

image posterization using k-means clustering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages