Skip to content

Instantly share code, notes, and snippets.

@MiffOttah
Last active November 6, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MiffOttah/609cc57e6205d18fe32f3c86a5b79b20 to your computer and use it in GitHub Desktop.
Save MiffOttah/609cc57e6205d18fe32f3c86a5b79b20 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# coding: utf8
# emojiencoder.py3 by MiffTheFox <https://miffthefox.info/>
"""
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
"""
import sys
def convertPngToEmoji(sourceFile, destFile):
source = sys.stdin if sourceFile == '-' else open(sourceFile, 'rb')
dest = sys.stdout if destFile == '-' else open(destFile, 'w')
dest.write('\U000E0300')
try:
byte = source.read(1)
while byte:
codepoint = ord(byte) | 0xe0300
dest.write(chr(codepoint))
byte = source.read(1)
finally:
pass
if __name__ == '__main__':
sourceFile = '-'
destFile = '-'
if len(sys.argv) >= 2:
sourceFile = sys.argv[1]
if (len(sys.argv) >= 3):
destFile = sys.argv[2]
convertPngToEmoji(sourceFile, destFile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment