添加 giftool 倒放选项
This commit is contained in:
@ -46,7 +46,7 @@
|
|||||||
- 若原始帧数 ≤ 指定帧数,则保留全部帧。
|
- 若原始帧数 ≤ 指定帧数,则保留全部帧。
|
||||||
|
|
||||||
--s <速度>(可选)
|
--s <速度>(可选)
|
||||||
- 调整 gif 图的速度
|
- 调整 gif 图的速度。若为负数,则代表倒放
|
||||||
|
|
||||||
使用方式
|
使用方式
|
||||||
1. 发送指令前,请确保:
|
1. 发送指令前,请确保:
|
||||||
|
|||||||
@ -71,8 +71,11 @@ async def _(
|
|||||||
raise BotExceptionMessage("错误:出点时间小于入点")
|
raise BotExceptionMessage("错误:出点时间小于入点")
|
||||||
if frame_count is not None and frame_count <= 0:
|
if frame_count is not None and frame_count <= 0:
|
||||||
raise BotExceptionMessage("错误:帧数量应该大于 0")
|
raise BotExceptionMessage("错误:帧数量应该大于 0")
|
||||||
if speed_factor <= 0:
|
if speed_factor == 0:
|
||||||
raise BotExceptionMessage("错误:--speed 必须大于 0")
|
raise BotExceptionMessage("错误:速度不能为 0")
|
||||||
|
|
||||||
|
is_rev = speed_factor < 0
|
||||||
|
speed_factor = abs(speed_factor)
|
||||||
|
|
||||||
if not getattr(image, "is_animated", False):
|
if not getattr(image, "is_animated", False):
|
||||||
raise BotExceptionMessage("错误:输入的不是动图(GIF)")
|
raise BotExceptionMessage("错误:输入的不是动图(GIF)")
|
||||||
@ -185,6 +188,10 @@ async def _(
|
|||||||
if transparency_flag:
|
if transparency_flag:
|
||||||
tf['transparency'] = 0
|
tf['transparency'] = 0
|
||||||
|
|
||||||
|
if is_rev:
|
||||||
|
rframes = rframes[::-1]
|
||||||
|
rdur = rdur[::-1]
|
||||||
|
|
||||||
if rframes:
|
if rframes:
|
||||||
rframes[0].save(
|
rframes[0].save(
|
||||||
output_img,
|
output_img,
|
||||||
|
|||||||
Reference in New Issue
Block a user