Emojisaic
From this:
To this:
See a few more examples (here.)
How To Use
Prerequisites
- Ruby 2.2.0 or newer
- The RMagick gem, which depends on ImageMagick. ImageMagick can be difficult to install so check the Rmagick or ImageMagick pages for instructions specific to your platform.
How to convert a gif or image
- Clone the repo, yo
-
cd
into the directory
-
bundle install
just in case
-
ruby emojisaic.rb -g [filename.gif]
(for a gif)
or
-
ruby emojisaic.rb -i [filename.jpg]
(for a still image)
- Wait.
- Marvel @ your emojisaic!
How It Works
cd
into the directorybundle install
just in caseruby emojisaic.rb -g [filename.gif]
(for a gif)
or ruby emojisaic.rb -i [filename.jpg]
(for a still image) Given the image above, the program will scan it in blocks--based on the size you ultimately want the emojis to be--and find the average color for each area. Then it'll find the emoji with the closest average color and replace the area with the matching emoji:
There are options for emoji size, zoom for the completed image, random offset for each emoji's placement, and a way to prefer emojis with fewer transparent pixels.
The whole process can be pretty slow depending on the resolution you're looking for and the number of frames in your gif, so if you're doing a large GIF I'd recommend running it as a still image first, which will convert the first frame and let you see what the final output will look like.
Options, Options, Options
at least one of these are mandatory:
-
-g [filename]
or--gif [filename]
- indicate location of the gif to convert -
-i [filename]
or--image [filename]
- indicate location of the still image to convert
optional options:
-
-s [int]
or--size [int]
- height of the emoji in pixels. default is 8. smaller size = longer conversion time -
-z [int]
or--zoom [int]
- multiply output file height and width by this number. default is 1. larger = longer conversion time -
-o [int]
or--offset [int]
- randomly move emojis by this many pixels. default is 0. #FreeOffset -
-c [int]
or--coverage [int]
- generally the emoji finder will use the emoji that is closest to the color for a given pixel area. setting this will prefer emojis with fewer transparent pixels which sometimes looks better -
-q
or--quiet
- silences all output and updates to the console
utilities (run these without any other options):
-
-t
or--tmp
- deletes all temporary images in the tmp/ folder -
-m
or--map
- regenerate emoji color map -
-h
or--help
- print these options to the console
Holler
How's my driving? Tweet 1-800-@NAH_SOLO