Skip to main content

Pilmoji for nonebot-plugin-parser

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()
    await Apilmoji.text_with_discord(
        image,
        (10, 40),
        text,
        font,
        fill=(0, 0, 0),
        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.4.tar.gz (8.5 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.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apilmoji-0.2.4.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.4.tar.gz
Algorithm Hash digest
SHA256 4bbf767b5f414f5a5fe42f7172c9d210ca393c7730a0816ad0a4b276900381c4
MD5 1c7aecb801af4d44e3adcd72ee29179e
BLAKE2b-256 c083708aa87dc4a099a5a248672996c5974932491ba867c2cd0235db0199a89f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apilmoji-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ec22f32bae6d0938c40bcac0a48e264be9fff55ed3629666820ed31671f78c4f
MD5 e0c55b61d212ef0f3b36a26297125a07
BLAKE2b-256 0fd64a2c058e585ef403ba118dc756259cf63dc3b8d660528257a16f182f2b36

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