Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mobeets/gifmoji-og
translate images and gifs into emoji mosaics
https://github.com/mobeets/gifmoji-og
emoji emojify emojis gif gifs
Last synced: 12 days ago
JSON representation
translate images and gifs into emoji mosaics
- Host: GitHub
- URL: https://github.com/mobeets/gifmoji-og
- Owner: mobeets
- Created: 2018-05-12T03:44:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T21:01:39.000Z (over 6 years ago)
- Last Synced: 2024-11-20T10:55:52.549Z (2 months ago)
- Topics: emoji, emojify, emojis, gif, gifs
- Language: Python
- Homepage:
- Size: 5.97 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Turns images or gifs into emojis.
The way it works is to repeatedly sample random 32x32 segments of a target image, and for each segment it selects the best emoji to go in that location.
The "best" emoji is chosen based on Euclidean distance in pixel space. For example, in a given 32x32 segment of the target image, it treats the pixel values as a 32*32*3-dimensional vector, and picks the emoji (each of which is also a 32*32*3-d vector) such that the L2 norm between the two vectors is smallest.
## Examples
(If you squint, you can see more detail of the original image.)
![trump](examples/trump.gif)
![doge](examples/doge.gif)
![kaleidoscope](examples/kaleidoscope.gif)
## Requirements
- Python (see `requirements.txt` for individual packages)
- [ImageMagick](https://www.imagemagick.org/script/index.php) to convert a collection of .png images to a single .gif## Instructions
To process a single .png file, you can run something like:
```
python gifmoji.py output --targetfile input.png --force_add --target_upsample 4
```Above, `--force_add` means that we must add an emoji at every segment of the target image, and `--target_upsample` means we will scale the target image's size by 4 to make an emoji image with better resolution.
To process a .gif into a series of .png made of emojis, you can run something like the following:
```
python gifmoji.py emoji-trump --targetfile trump.gif --is_gif --force_add --outdir images/trump --target_upsample 4
```This will output a series of .png files named `emoji-trump-*.png`, where `*` will be 0, 1, 2, etc. This will take some time to run!
__If you want a super fast version (seconds rather than minutes), with emojis on a fixed and non-overlapping grid, add `--quick`.__
You can then run the following (using [ImageMagick](https://www.imagemagick.org/script/index.php)) to combine the .pngs into a single .gif:
```
convert -dispose previous -delay 1 emoji-trump-*.png emoji-trump.gif
```