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.
- Go to Telegram API and log in.
- Click on the
API development tools
link. - A
Create new application
window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later. - Click on
Create application
at the end. - Copy
api_id
,api_hash
,bot_token
(from@BotFather
) and paste them in theconfig.json
file.
- 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": "your_bot_name",
"api_id": "your_api_id",
"api_hash": "your_api_hash",
"bot_token": "your_bot_token",
"proxy": {
"status": "False", // "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`.
"scheme": "http",
"hostname": "your_proxy_hostname",
"port": "your_proxy_port"
}
}
- 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 StickerSet 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:
/sets https://t.me/addstickers/PeopleMemes 256x256x100
256x256x100
is the size of the gif, and the quality, you can change it to any size you want.
default is original size and quality 100, if you didn't provide the size and quality.
- 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.