Skip to main content

easy and fast processing of telegram stickers

Project description

📦 Telegram Sticker Utils SDK

PyPI version Downloads

If you are not a developer, you can use the Telegram Sticker CLI (developed by this SDK) for user-friendly operations.

This SDK provides a set of utilities for working with Telegram stickers.

  • Convert image formats without losing transparency.
  • Auto optimize output size for sticker, make it valid for Telegram.
  • Auto-detect sticker type and emojis.

🛠 Supported Pack Types

  • Video Sticker
  • Static Sticker
  • Animated Sticker(Tgs)

🚀 Installation

You need install ImageMagick and ffmpeg before using this SDK.

Install Guide: https://docs.wand-py.org/en/0.6.12/guide/install.html

apt install ffmpeg
pip3 install telegram-sticker-utils

📖 Usage

import emoji

from telegram_sticker_utils import ImageProcessor
from telegram_sticker_utils import is_animated_gif
from telegram_sticker_utils.core.const import add_emoji_rule

try:
    add_emoji_rule("sad", "😢")
    add_emoji_rule("happy", emoji.emojize(":smile:"))
except ValueError as e:
    print("NOT emoji")

print(is_animated_gif('test.gif'))  # Path to the image file or a file-like object.

for sticker_file in ["happy.webp", "sad.png", "高兴.jpg", "悲伤.gif"]:
    sticker = ImageProcessor.make_sticker(
        input_name=sticker_file,
        input_data=open(sticker_file, 'rb').read(),
        scale=512
    )
    print(sticker.sticker_type)
    print(sticker.emojis)
    with open(f"{sticker_file}.{sticker.file_extension}", 'wb') as f:
        f.write(sticker.data)

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

telegram_sticker_utils-0.2.15.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

telegram_sticker_utils-0.2.15-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file telegram_sticker_utils-0.2.15.tar.gz.

File metadata

  • Download URL: telegram_sticker_utils-0.2.15.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.2 CPython/3.12.3 Linux/6.8.0-1015-azure

File hashes

Hashes for telegram_sticker_utils-0.2.15.tar.gz
Algorithm Hash digest
SHA256 a4d7bfe6ec00dbce9ac6d858e12fe9cc0b0a1c05f8103253435043b7697d9add
MD5 8515c188ec57caec4dd0383903f6a309
BLAKE2b-256 f4a07ed1315a1b9d3a4d0d35e61b27ad0b9d8f1ba129e3fa30a6be5e2b9e270c

See more details on using hashes here.

Provenance

File details

Details for the file telegram_sticker_utils-0.2.15-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_sticker_utils-0.2.15-py3-none-any.whl
Algorithm Hash digest
SHA256 8afb0072c33623d6d9bfa98180e7d658a2bfd371ad3cca58c9de0e61530a960d
MD5 b64347296d8238f2b4dce54ff615dac5
BLAKE2b-256 6fbe26a38a0ec3773c77b8b8a8a5c4d4d8dfc7798f15861333cca408ba7e98c3

See more details on using hashes here.

Provenance

Supported by

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