# π¦ Telegram Sticker Utils SDK
[](https://badge.fury.io/py/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
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "telegram-sticker-utils",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.9",
"maintainer_email": null,
"keywords": "telegram, sticker, image, video, processing, ffmpeg, pillow",
"author": null,
"author_email": "sudoskys <coldlando@hotmail.com>",
"download_url": "https://files.pythonhosted.org/packages/44/5e/5084548bab069d817b4474cc435cd4beb6a5e4e3fbc0e8972676d5022c0b/telegram_sticker_utils-0.2.22.tar.gz",
"platform": null,
"description": "# \ud83d\udce6 Telegram Sticker Utils SDK\n\n[](https://badge.fury.io/py/telegram-sticker-utils)\n[](https://pepy.tech/project/telegram-sticker-utils)\n\nIf you are not a developer, you can use the Telegram Sticker [CLI](https://github.com/sudoskys/tsticker) (developed by\nthis SDK) for\nuser-friendly operations.\n\nThis SDK provides a set of utilities for working with Telegram stickers.\n\n- Convert image formats without losing transparency.\n- Auto optimize output size for sticker, make it valid for Telegram.\n- Auto-detect sticker type and emojis.\n\n## \ud83d\udee0 Supported Pack Types\n\n- [x] Video Sticker\n- [x] Static Sticker\n- [ ] Animated Sticker(Tgs)\n\n## \ud83d\ude80 Installation\n\nYou need install **[ImageMagick](https://github.com/imagemagick/imagemagick)** and \n**[ffmpeg](https://www.ffmpeg.org/download.html)** before using this SDK.\n\nInstall Guide: https://docs.wand-py.org/en/0.6.12/guide/install.html\n\n```shell\napt install ffmpeg\npip3 install telegram-sticker-utils\n```\n\n## \ud83d\udcd6 Usage\n\n```python\nimport emoji\n\nfrom telegram_sticker_utils import ImageProcessor\nfrom telegram_sticker_utils import is_animated_gif\nfrom telegram_sticker_utils.core.const import add_emoji_rule\n\ntry:\n add_emoji_rule(\"sad\", \"\ud83d\ude22\")\n add_emoji_rule(\"happy\", emoji.emojize(\":smile:\"))\nexcept ValueError as e:\n print(\"NOT emoji\")\n\nprint(is_animated_gif('test.gif')) # Path to the image file or a file-like object.\n\nfor sticker_file in [\"happy.webp\", \"sad.png\", \"\u9ad8\u5174.jpg\", \"\u60b2\u4f24.gif\"]:\n sticker = ImageProcessor.make_sticker(\n input_name=sticker_file,\n input_data=open(sticker_file, 'rb').read(),\n scale=512\n )\n print(sticker.sticker_type)\n print(sticker.emojis)\n with open(f\"{sticker_file}.{sticker.file_extension}\", 'wb') as f:\n f.write(sticker.data)\n```",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "easy and fast processing of telegram stickers",
"version": "0.2.22",
"project_urls": {
"Repository": "https://github.com/sudoskys/telegram-sticker-utils"
},
"split_keywords": [
"telegram",
" sticker",
" image",
" video",
" processing",
" ffmpeg",
" pillow"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "55a4825a539fdac8d97717ecc9b73e09cb4be2d3bf60adab015cefe64e75dfd8",
"md5": "b30e65b4bc5d3d853fd26f4c47b0e341",
"sha256": "a938e79bd9c05b88b19c0f2cbbcc0a7363d65d3682b5c9b29b638e9d650b9c7a"
},
"downloads": -1,
"filename": "telegram_sticker_utils-0.2.22-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b30e65b4bc5d3d853fd26f4c47b0e341",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 21337,
"upload_time": "2025-02-16T04:15:26",
"upload_time_iso_8601": "2025-02-16T04:15:26.442108Z",
"url": "https://files.pythonhosted.org/packages/55/a4/825a539fdac8d97717ecc9b73e09cb4be2d3bf60adab015cefe64e75dfd8/telegram_sticker_utils-0.2.22-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "445e5084548bab069d817b4474cc435cd4beb6a5e4e3fbc0e8972676d5022c0b",
"md5": "b5d02c3b75f04210cd313a78dab348cc",
"sha256": "b34dbf7b9f7a2172ba0ba7f3d89c93c8b000525d06f823c4d40d36adb046ff8b"
},
"downloads": -1,
"filename": "telegram_sticker_utils-0.2.22.tar.gz",
"has_sig": false,
"md5_digest": "b5d02c3b75f04210cd313a78dab348cc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 20610,
"upload_time": "2025-02-16T04:15:28",
"upload_time_iso_8601": "2025-02-16T04:15:28.238307Z",
"url": "https://files.pythonhosted.org/packages/44/5e/5084548bab069d817b4474cc435cd4beb6a5e4e3fbc0e8972676d5022c0b/telegram_sticker_utils-0.2.22.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-16 04:15:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sudoskys",
"github_project": "telegram-sticker-utils",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "telegram-sticker-utils"
}