Skip to content

laudenberg/triangle-pixels

Repository files navigation

triangle-pixels

Inspired by The pxl effect with javascript and canvas (and maths), this script creates a similar "pxl"-effect for any input image with a couple of lines of Ruby.

Portrait Portrait Triangles

Installation

This script requires rmagick for reading the image and haml for writing svg.

$ gem install rmagick
$ gem install haml

Or, simply use the Gemfile in the root directory with bundler.

$ bundle install

Usage

$ ./triangle-pixels.rb /path/to/image.jpg 20 50 > /path/to/result.svg

Will load the file /path/to/image.jpg to produce 20 columns of squares, holding two triangles, with a size of 50x50px each (defaults to 20px). The number of rows is calculated according to the geometry of the image. An optional parameter --keep will keep possibly not completely filled edges. The result is written to /path/to/result.svg. You could use software like Inkscape to view, edit, or convert the image.

$ inkscape -f /path/to/result.svg -e /path/to/result.png -C -d 90

Will convert the result to a PNG-image with a dpi of 90.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages