Skip to content

Commit b4d4f84

Browse files
authored
Update tgs_converter to match updated lottieconverter (#694)
1 parent 2cc4398 commit b4d4f84

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

mautrix_telegram/example-config.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,15 @@ bridge:
223223
# Format to which animated stickers should be converted.
224224
# disable - No conversion, send as-is (gzipped lottie)
225225
# png - converts to non-animated png (fastest),
226-
# gif - converts to animated gif, but loses transparency
226+
# gif - converts to animated gif
227227
# webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
228228
target: gif
229229
# Arguments for converter. All converters take width and height.
230230
# GIF converter takes background as a hex color.
231231
args:
232232
width: 256
233233
height: 256
234-
background: "020202" # only for gif
235-
fps: 30 # only for webm
234+
fps: 25 # only for webm and gif (2, 5, 10, 20, 25 and 50 recommended)
236235
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
237236
# and login_shared_secret to be configured in order to get a device for the bridge bot.
238237
#

mautrix_telegram/util/tgs_converter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ async def tgs_to_png(file: bytes, width: int, height: int, **_: Any) -> Converte
6464
return ConvertedSticker("application/gzip", file)
6565

6666

67-
async def tgs_to_gif(file: bytes, width: int, height: int, background: str = "202020",
67+
async def tgs_to_gif(file: bytes, width: int, height: int, fps: int = 25,
6868
**_: Any) -> ConvertedSticker:
6969
proc = await asyncio.create_subprocess_exec(lottieconverter, "-", "-", "gif",
70-
f"{width}x{height}", f"0x{background}",
70+
f"{width}x{height}", str(fps),
7171
stdout=asyncio.subprocess.PIPE,
7272
stdin=asyncio.subprocess.PIPE)
7373
stdout, stderr = await proc.communicate(file)

0 commit comments

Comments
 (0)