Compare commits

...

1 Commits

Author SHA1 Message Date
af566888ab fix2 2025-10-12 15:24:49 +08:00

View File

@ -171,6 +171,20 @@ async def _(
rframes.append(selected_frames[max(2, len(selected_frames) // 2)])
rdur.append(20)
transparency_flag = False
for f in rframes:
if f.mode == "RGBA":
if any(pix < 255 for pix in f.getchannel("A").getdata()):
transparency_flag = True
break
elif f.mode == "P" and "transparency" in f.info:
transparency_flag = True
break
tf = {}
if transparency_flag:
tf['transparency'] = 0
if rframes:
rframes[0].save(
output_img,
@ -181,7 +195,7 @@ async def _(
loop=0,
optimize=False,
disposal=2,
transparency=0,
**tf,
)
else:
raise BotExceptionMessage("错误:没有可输出的帧")