getemoji is a command-line interface (CLI) tool that allows you to generate emoji images in SVG or PNG format. It downloads the emoji from twemoji and can optionally resize it to a specified size.
- Generate emoji images in SVG or PNG format
- Resize emojis to a specific size (for PNG output)
- Support for emoji shortcodes and Unicode characters
- Configurable via command-line flags, environment variables, or a YAML config file
There are two ways to install getemoji:
-
Using Go: To install getemoji, you need to have Go installed on your system. Then, you can use the following command:
go install github.com/igolaizola/getemoji@latest -
Downloading pre-built binaries: You can download pre-built binaries for your operating system from the Releases page of the GitHub repository.
The basic syntax for using getemoji is:
getemoji --emoji <emoji> --size <size> --output <output>
-emoji: The emoji to generate (required)-size: The size of the output image in pixels (required for PNG output)-output: The output file name (optional, defaults toicon.svgoricon<size>.png)-config: Path to a YAML configuration file (optional)
You can also use environment variables to set the flags. Prefix the flag name with GETEMOJI_. For example:
GETEMOJI_EMOJI="smile" GETEMOJI_SIZE=64 GETEMOJI_OUTPUT="smile.png" getemoji
-
Generate an SVG of a smiley face emoji:
getemoji -emoji "smile" -output smile.svg -
Generate a 64x64 PNG of a heart emoji:
getemoji -emoji "❤️" -size 64 -output heart.png -
Use a configuration file:
getemoji -config config.yamlExample
config.yaml:emoji: "rocket" size: 128 output: rocket.png
You can check the version of getemoji by running:
getemoji version
This will display the version number, commit hash, and build date (if available).
getemoji uses the following open-source libraries:
- github.com/kyokomi/emoji/v2
- github.com/srwiley/oksvg
- github.com/srwiley/rasterx
- github.com/peterbourgon/ff/v3
getemoji is licensed under the MIT License.
The emoji graphics are from twemoji and are downloaded using https://cdn.jsdelivr.net/gh/jdecked/twemoji.
These graphics are licensed under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).
To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
Contributions to getemoji are welcome! Please feel free to submit a Pull Request.
If you encounter any problems or have any questions about getemoji, please open an issue on the GitHub repository.