Skip to content

πŸ“¦ Telegram Sticker Maker Utils | Quickly* process an image into a format acceptable to Telegram

License

Notifications You must be signed in to change notification settings

Haerbin23456/telegram-sticker-utils

This branch is 18 commits behind sudoskys/telegram-sticker-utils:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f9d940e Β· Dec 19, 2024

History

68 Commits
Mar 24, 2024
Oct 13, 2024
Dec 19, 2024
Mar 24, 2024
Mar 24, 2024
Mar 24, 2024
Oct 13, 2024
Aug 18, 2024
Oct 13, 2024

Repository files navigation

πŸ“¦ 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)

About

πŸ“¦ Telegram Sticker Maker Utils | Quickly* process an image into a format acceptable to Telegram

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%