Skip to content

Instantly share code, notes, and snippets.

@cj81499
Created February 20, 2026 17:07
Show Gist options
  • Select an option

  • Save cj81499/3a5370e613ecc903061e0ec215418c78 to your computer and use it in GitHub Desktop.

Select an option

Save cj81499/3a5370e613ecc903061e0ec215418c78 to your computer and use it in GitHub Desktop.
Export apple color emoji as PNG images.
# /// script
# requires-python = ">=3.14"
# dependencies = [
# "emoji>=2.15.0",
# "pillow>=12.1.1",
# ]
# ///
from pathlib import Path
import emoji
from PIL import Image, ImageDraw, ImageFont
output = Path("output")
output.mkdir(parents=True, exist_ok=True)
font = ImageFont.truetype("/System/Library/Fonts/Apple Color Emoji.ttc", 160)
for e, v in emoji.EMOJI_DATA.items():
if len(e) == 1:
img = Image.new("RGBA", (160, 160), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
draw.text((0, 0), e, font=font, embedded_color=True)
name = v["en"] or v["alias"][-1]
fname = f"{name}_{e}.png"
try:
img.save(output / fname)
except OSError: # illegal byte sequence
backup_fname = f"{name}_{ord(e)}.png"
print(f"Failed to save as {fname}. Saving as {backup_fname} instead.")
img.save(output / backup_fname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment