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.24.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

telegram_sticker_utils-0.2.24-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: telegram_sticker_utils-0.2.24.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.24.1 CPython/3.12.3 Linux/6.11.0-1014-azure

File hashes

Hashes for telegram_sticker_utils-0.2.24.tar.gz
Algorithm Hash digest
SHA256 4449d4d3ba13ff917a9afcd2ebcf0dd0067d1b08cf430d9e24c3b3a20b470937
MD5 37bb64f41821753b38a1aaa34c1d008f
BLAKE2b-256 b3865c04745e9d99e13d3fa604dbb7c116a5b14ff2e1b29fcaabaca8e62a9b40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for telegram_sticker_utils-0.2.24-py3-none-any.whl
Algorithm Hash digest
SHA256 d42abeda9c3d0e4514f29f32d5f9b6433273e174e01a4f1f394c1a25a3b2200e
MD5 548ec9f5a18c6c3e7ef2960a1d099fb4
BLAKE2b-256 184dc0f20d900607626544fa543e94a8ad628611133c62598bd2f01cf9c91f76

See more details on using hashes here.

Supported by

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