A TGS file can be inspected by decompressing its gzip payload and reading the resulting JSON. That helps explain its dimensions, timing and layer structure. It does not turn the file back into its original SVG or prove that every animation feature is compatible with Telegram.

Inspect a copy and identify the question

Keep the original TGS unchanged while investigating. Decide what you want to learn: whether the file is actually gzip data, what canvas it describes, how long it runs or why a particular layer may be unsupported. A focused question keeps the inspection useful.

A file with a .tgs extension might be a valid animation, a wrongly renamed JSON document or something else. Start by reading it with a gzip-aware tool rather than opening the compressed bytes as ordinary text. If decompression fails, fix the packaging or obtain a fresh export before interpreting animation fields.

Read your own export with Python

The following example reads a local file named sticker.tgs, limits the decompressed payload it will inspect and parses JSON. It prints a few diagnostic fields without rewriting the source. Run it on a copy of an export you intend to inspect.

This is an inspection helper, not a complete Telegram validator. It does not render the artwork, inspect every shape or repair unsupported animation features.

python
import gzip
import json
from pathlib import Path

source = Path("sticker.tgs")
limit = 4 * 1024 * 1024
with gzip.open(source, "rb") as handle:
    payload = handle.read(limit + 1)
if len(payload) > limit:
    raise ValueError("JSON exceeds this inspection limit")
data = json.loads(payload)
if not isinstance(data, dict):
    raise ValueError("Expected a JSON object")
print("Compressed bytes:", source.stat().st_size)
for key in ("w", "h", "fr", "ip", "op"):
    print(key, data.get(key))
print("Layers:", len(data.get("layers", [])))

Interpret the basic timing and canvas fields

The width and height fields describe the composition dimensions. Frame rate and the animation’s in and out points describe its timeline. For a simple composition starting at zero, dividing the frame span by the frame rate gives the duration in seconds.

As an illustrative calculation, a span of 120 frames at 60 FPS represents two seconds. Do not assume that a plausible duration proves a seamless loop. A file can have correct timing metadata while its final pose jumps visibly back to the first one. That requires visual inspection.

Look beyond a plausible header

Check the layer and asset structure when the animation depends on content that Telegram does not support in TGS. Embedded images, text layers or effects may explain a rejection even when the canvas and timing look reasonable. A complete validator needs to examine more than the few fields printed above.

Do not manually delete unfamiliar JSON fields until the file stops reporting an error. That can remove essential geometry or animation information. Prefer repairing the editable source and exporting again. Keep the inspection output as evidence that helps the creator locate the problem.

Finish with visual review and source preservation

Use the official requirements and a suitable validator, then inspect the animation in Telegram. Compare the intended silhouette, transparency, movement and loop seam. Structural checks and visual checks answer different questions and are both useful.

The site’s square SVG, readable JSON and TGS example can help distinguish source artwork from animation delivery data. SVG to TGS itself does not import an existing TGS or JSON for editing. If you need to change an animation you received, request the original project or SVG rather than assuming the compressed file contains every editable design decision.

Sources & further reading