Converter for Telegram stickers and animations into various formats.
Go to file
eugene 3f85891111 add anullsrc audio input to webm converter 2025-09-16 18:59:57 +03:00
cmd deps 2025-09-10 23:47:01 +03:00
tgs add anullsrc audio input to webm converter 2025-09-16 18:59:57 +03:00
webm add anullsrc audio input to webm converter 2025-09-16 18:59:57 +03:00
webp refactor 2025-09-10 20:08:33 +03:00
.gitignore init commit 2025-09-05 22:14:40 +03:00
LICENSE add license 2025-09-10 20:35:34 +03:00
Makefile package refactor 2025-09-08 21:37:35 +03:00
README.md add license 2025-09-10 20:35:34 +03:00
go.mod deps 2025-09-10 23:47:01 +03:00
go.sum deps 2025-09-10 23:47:01 +03:00
tgs.go add cachekey 2025-09-14 22:39:50 +03:00
types.go package refactor 2025-09-08 21:37:35 +03:00
webm.go package refactor 2025-09-08 21:37:35 +03:00
webp.go refactor 2025-09-10 20:08:33 +03:00

README.md

Telegram Sticker Converter

Converter for Telegram stickers and animations into various formats.
Supports TGS, WEBP, WEBM, with the ability to extract single frames, frame sequences, or convert to video.

Features

  • Support for main Telegram sticker formats: TGS, WEBP, WEBM
  • Conversion to static images, animations, and videos
  • Flexible frame extraction: first, single, range, or all frames
  • Resizing on transformation
  • Easy to use as a Go library

Requirements

  • Go ≥ 1.24\
  • ffmpeg ≥ 7.1.1 (for video/animations)

Supported conversions

Input Output
TGS PNG (first, all, N-th, range)
JPEG (same)
WEBP (same)
Lottie JSON
GIF
WEBM
MP4
WEBP PNG
JPEG
WEBM MP4
GIF
PNG (first, all, N-th, range)
JPEG (same)
WEBP (same)

Installation

go get github.com/yazmeyaa/telegram_sticker_converter

Usage examples

General pattern: open input file, create output file, pass TransformOptions.

Extract frame from TGS

conv := tgs.NewConverter()

r, _ := os.Open("./sticker.tgs")
defer r.Close()

w, _ := os.Create("./sticker.png")
defer w.Close()

opts := converter.TGSTransformOptions{
    Format:     converter.FormatPNG,
    Frame:      converter.FrameN,
    FrameIndex: 10,
    ResizeWidth:  1024,
    ResizeHeight: 1024,
}

_ = conv.Transform(context.Background(), r, w, opts)

Convert TGS → MP4

opts := converter.TGSTransformOptions{
    Format:      converter.FormatMP4,
    ResizeWidth: 1024,
    ResizeHeight: 1024,
}
_ = conv.Transform(ctx, r, w, opts)

Convert TGS → ZIP with frames

opts := converter.TGSTransformOptions{
    Format:      converter.FormatPNG,
    Frame:       converter.FrameAll,
    ResizeWidth: 1024,
    ResizeHeight: 1024,
}
_ = conv.Transform(ctx, r, w, opts)

License

GPLv3