Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Will McCutchen
committed
Jun 25, 2012
1 parent
715c3e6
commit f34addb
Showing
6 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Triangulizor | ||
|
||
<img src="https://github.com/mccutchen/triangulizor/raw/master/examples/in.jpg" align="middle"> | ||
➡☁➡ | ||
<img src="https://github.com/mccutchen/triangulizor/raw/master/examples/out.png" align="middle"> | ||
|
||
## Usage | ||
|
||
Triangulizor requires Python 2.7+ and the [Python Imaging Library][3]. First, | ||
install `PIL` (usually this is as easy as `pip install pil`). Next, find an | ||
image to triangulize! To generate the example above, either of these commands | ||
will do the trick: | ||
|
||
```bash | ||
./triangulizor.py --debug --tile-size=16 examples/in.jpg | ||
``` | ||
|
||
The `--debug` flag will cause the resulting image to be displayed immediately | ||
instead of written to `stdout` or to disk. You can also pass in the URL to an | ||
image that you want to process: | ||
|
||
```bash | ||
./triangulizor.py --debug --tile-size=16 https://github.com/mccutchen/triangulizor/raw/master/examples/in.jpg | ||
``` | ||
|
||
All command line options are given below: | ||
|
||
```bash | ||
$ ./triangulizor.py --help | ||
``` | ||
|
||
``` | ||
usage: triangulizor.py [-h] [-t TILE_SIZE] [-v] [-vv] [-d] [infile] [outfile] | ||
Applies a "triangular pixel" effect to an image. | ||
positional arguments: | ||
infile Image to process (path or URL; defaults to STDIN) | ||
outfile Output file (defaults to STDOUT) | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-t TILE_SIZE, --tile-size TILE_SIZE | ||
Tile size (must be divisible by 2; defaults to 20) | ||
-v, --verbose Verbose output | ||
-vv Very verbose output | ||
-d, --debug Immediately display image instead of writing to | ||
OUTFILE. | ||
``` | ||
|
||
## Credits | ||
|
||
This was inspired entirely by [this awesomely helpful blog post][1] by | ||
[@revdancatt][2]. | ||
|
||
[1]: http://revdancatt.com/2012/03/31/the-pxl-effect-with-javascript-and-canvas-and-maths/ | ||
[2]: http://twitter.com/revdancatt | ||
[3]: http://pypi.python.org/pypi/PIL |
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters