Skip to main content

Pilmoji for nonebot-plugin-parser

Reason this release was yanked:

无法区分组合表情

Project description

Apilmoji

An asynchronous emoji rendering Extension for PIL

LICENSE pypi python ruff pre-commit codecov

✨ Features

  • 🎨 Unicode Emoji Support - Render standard Unicode emojis
  • 💬 Discord Emoji Support - Render custom Discord emojis
  • 🔄 Concurrent Downloads - Support concurrent emoji downloads for better performance
  • 💾 Smart Caching - Local file caching to avoid repeated downloads
  • 🎭 Multiple Styles - Support for Apple, Google, Twitter, Facebook, and other styles
  • 📊 Progress Display - Optional progress bar for download progress

📦 Installation

Requirements: Python 3.10 or higher

uv add apilmoji

Or install from source:

uv add git+https://github.com/fllesser/apilmoji

🚀 Quick Start

Basic Usage (Unicode Emojis Only)

import asyncio
from PIL import Image, ImageFont
from apilmoji import Apilmoji


async def main():
    text = """
    Hello, world! 👋
    "We have standard emojis: 😂, 🚀, 🐍, 💻.",
    "And some more: 🌟✨🔥💯.",
    """

    # create image
    image = Image.new("RGB", (550, 150), (255, 255, 255))
    font = ImageFont.truetype("arial.ttf", 24)

    # render text with emojis
    await Apilmoji.text(image, (10, 10), text.strip(), font, fill=(0, 0, 0))

    image.save("output.png")
    image.show()


asyncio.run(main())

Discord Emoji Support

import asyncio
from PIL import Image, ImageFont
from apilmoji import Apilmoji, EmojiCDNSource

async def main():
    text = """
    Unicode emojis: 👋 🎨 😎
    Discord emojis: <:rooThink:123456789012345678>
    """

    image = Image.new("RGB", (550, 100), (255, 255, 255))
    font = ImageFont.truetype("arial.ttf", 24)
    source = EmojiCDNSource(enable_discord=True)
    await Apilmoji.text(
        image,
        (10, 40),
        text,
        font,
        fill=(0, 0, 0),
        support_ds_emj=True,
        source=source,
    )

    image.save("output.png")

asyncio.run(main())

🎨 Emoji Styles

Choose different emoji styles:

from apilmoji import Apilmoji, EmojiCDNSource, EmojiStyle

# Apple style (default)
source = EmojiCDNSource(style=EmojiStyle.APPLE)

# Google style
source = EmojiCDNSource(style=EmojiStyle.GOOGLE)

await Apilmoji.text(
    image,
    (10, 10),
    "Hello 👋",
    font,
    source=source
)

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🐛 Issues

If you encounter any issues, please report them on the GitHub Issues page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apilmoji-0.2.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apilmoji-0.2.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file apilmoji-0.2.2.tar.gz.

File metadata

  • Download URL: apilmoji-0.2.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for apilmoji-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e3fa0d9b62380098f3bfa11ebefbe42ad2aa71727fb4c9f8ad3b8f059e5ee7b1
MD5 4114602f5fcd81f691fdc89f484cd0a0
BLAKE2b-256 819de4c9910038e69721d2f0f20324a4429548b4beb7cdb7f6be29b697e74aca

See more details on using hashes here.

File details

Details for the file apilmoji-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: apilmoji-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for apilmoji-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 016dc65e5d6330934a967a924f3802d1322863a86f4ac43d098d5dc1c88010ed
MD5 ba920e249948a236b9e12e4338e50d29
BLAKE2b-256 146cc579aa6800cbe650ea3c116039ac017d90581398dd0c64e82201ee7c1360

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page