I prefer you to use this tool now, repo: https://github.com/SwaggyMacro/LottieViewConvert
An elegant, ready-to-use GUI that supports converting TGS or Lottie files into GIF, WebP, APNG, WebM, MKV, MP4, and AVIF. It offers fine-grained parameter control—FPS, playback speed adjustment to solve slow playback issues in exported GIFs, freely adjustable resolution, and quality settings. Batch conversion is supported, and you can supply Telegram sticker-pack URLs or names for automatic downloading. Built-in internationalization allows multiple languages, and dependencies can be installed automatically.
Feature:
- Convert Telegram sticker(
tgs
) to GIF, PNG, APNG, and WEBP. - Convert Telegram sticker sets to GIF, PNG, APNG, and WEBP.
- Download
.tgs
files(including sticker sets).
🤖 Demo Bot: @sticker_to_gif_01_bot
Sticker set conversion has been disabled
on this bot to minimize resource usage and prevent abuse. Only single sticker
can be converted to GIF, PNG, APNG, or WEBP. However, downloading the full .tgs files of sticker sets is still allowed
.
Install run-time dependencies. Make sure the path to them present in PATH variable:
- gifski if you want to convert to GIF
- ffmpeg if you want to convert to APNG
- img2webp if you want to convert to WEBP
gifski is the only dependency required to convert to GIF, gif only
in this repo, you may skip the rest if you don't
want to convert to APNG or WEBP.
- gifski
- Ubuntu: Install gifski using the following command in three different ways:
brew install gifski
sudo snap install gifski
cargo install gifski
- Windows: Download the installer from the gifski website.
- You may need to install GTk3
runtime for lottie to work properly in windows(
reboot required
).
- Ubuntu: Install gifski using the following command in three different ways:
chmod +777 ./TgStoGif -R
- Create a bot using BotFather.
- Copy the bot token and save it for later.
- here's a guide on how to create a bot.
- Install the required dependencies using the following command:
pip install -r requirements.txt
- copy the
config.json.example
file toconfig.json
and fill in the required fields.
{
"bot_name": "Bot name",
"bot_token": "from @BotFather",
"bot_username": "@BotUsername",
"allow_sticker_sets": true, // "True" if you want to allow the bot to convert the whole sticker set, "False" if you don't want to allow the bot to convert the whole sticker set.
"convert_workers": 5,
"download_workers": 5,
"proxy": {
"status": true, //true if you want to use a proxy, "False" if you don't want to use a proxy, and fill in the proxy details below, `without this note`.
"type": "http",
"host": "127.0.0.1",
"port": 10803,
"username": "",
"password": ""
}
}
- Run the script using the following command:
python main.py
- Send a sticker to the bot, and it will convert it to a gif and send it back to you.
- Send a sticker set link to the bot, and it will convert all the stickers in the set to gif and zip it then send it back to you.
For example, you can use the following sticker set link to test the bot:
https://t.me/addstickers/GumLoveIs
QQ202563-152651-HD.mp4
- lottie-converter - Convert Lottie animations to GIF, APNG, and WebP.
- lottie - Render After Effects animations natively on Web, Android and iOS, and React Native.
- pyrogram - Telegram MTProto API Client Library and Framework in Pure Python for Users and Bots.
- gifski - GIF encoder
- ffmpeg - A complete, cross-platform solution to record, convert and stream audio and video.