mirror of
https://github.com/Refound-445/nonebot-plugin-nailongremove.git
synced 2025-11-04 21:22:43 +08:00
up
This commit is contained in:
parent
1f21034b4c
commit
929f649e9c
@ -108,11 +108,10 @@ def get_avg_duration(image: Img.Image) -> float:
|
|||||||
if not getattr(image, "is_animated", False):
|
if not getattr(image, "is_animated", False):
|
||||||
return 0
|
return 0
|
||||||
total_duration = 0
|
total_duration = 0
|
||||||
n_frames = getattr(image, "n_frames", 1)
|
frames = list(ImageSequence.Iterator(image))
|
||||||
for i in range(n_frames):
|
for frame in frames:
|
||||||
image.seek(i)
|
total_duration += frame.info.get("duration", 20)
|
||||||
total_duration += image.info.get("duration", 20)
|
return total_duration / len(frames) / 1000
|
||||||
return total_duration / n_frames / 1000
|
|
||||||
|
|
||||||
|
|
||||||
@repack_saver(PilImageFrameSource)
|
@repack_saver(PilImageFrameSource)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user