Create a gist now

Instantly share code, notes, and snippets.

#!/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