Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sudoskys/telegram-sticker-utils
π¦ Telegram Sticker Maker Utils | Quickly* process an image into a format acceptable to Telegram
https://github.com/sudoskys/telegram-sticker-utils
telegram telegram-sticker
Last synced: 27 days ago
JSON representation
π¦ Telegram Sticker Maker Utils | Quickly* process an image into a format acceptable to Telegram
- Host: GitHub
- URL: https://github.com/sudoskys/telegram-sticker-utils
- Owner: sudoskys
- License: apache-2.0
- Created: 2024-03-24T14:44:12.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-24T16:52:02.000Z (8 months ago)
- Last Synced: 2024-07-13T11:19:18.953Z (4 months ago)
- Topics: telegram, telegram-sticker
- Language: Python
- Homepage:
- Size: 2.21 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π¦ Telegram Sticker Utils SDK
[![PyPI version](https://badge.fury.io/py/telegram-sticker-utils.svg)](https://badge.fury.io/py/telegram-sticker-utils)
[![Downloads](https://pepy.tech/badge/telegram-sticker-utils)](https://pepy.tech/project/telegram-sticker-utils)If you are not a developer, you can use the Telegram Sticker [CLI](https://github.com/sudoskys/tsticker) (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
- [x] Video Sticker
- [x] Static Sticker
- [ ] Animated Sticker(Tgs)## π Installation
You need install **[ImageMagick](https://github.com/imagemagick/imagemagick)** and
**[ffmpeg](https://www.ffmpeg.org/download.html)** before using this SDK.Install Guide: https://docs.wand-py.org/en/0.6.12/guide/install.html
```shell
apt install ffmpeg
pip3 install telegram-sticker-utils
```## π Usage
```python
from telegram_sticker_utils import ImageProcessor
from telegram_sticker_utils import is_animated_gifprint(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)
```