From a829f035b3cca6840911c3e2b3296ad18bc93c73 Mon Sep 17 00:00:00 2001 From: MixBadGun <1059129006@qq.com> Date: Wed, 10 Dec 2025 17:22:12 +0800 Subject: [PATCH] new fx --- konabot/plugins/fx_process/__init__.py | 6 ++++-- konabot/plugins/fx_process/fx_handle.py | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/konabot/plugins/fx_process/__init__.py b/konabot/plugins/fx_process/__init__.py index a2b76b3..9da8af1 100644 --- a/konabot/plugins/fx_process/__init__.py +++ b/konabot/plugins/fx_process/__init__.py @@ -178,11 +178,13 @@ async def apply_filters_to_images(images: list[Image.Image], filters: list[Filte output = BytesIO() if getattr(img, "is_animated", False) or frozen_to_move: frames = [] + append_images = [] if getattr(img, "is_animated", False): logger.debug("处理动图帧") else: - # 将静态图视作单帧动图处理,拷贝多份 + # 将静态图视作单帧动图处理,拷贝 10 帧 logger.debug("处理静态图为多帧动图") + append_images = [img.copy() for _ in range(10)] img.info['duration'] = int(1000 / static_fps) async def process_single_frame(frame_images: list[Image.Image], frame_idx: int) -> Image.Image: @@ -195,7 +197,7 @@ async def apply_filters_to_images(images: list[Image.Image], filters: list[Filte # 并发处理所有帧 tasks = [] all_frames = [] - for i, frame in enumerate(ImageSequence.Iterator(img)): + for i, frame in enumerate(list(ImageSequence.Iterator(img)) + append_images): all_frames.append(frame.copy()) images_copy = copy_images_by_index(images, i) task = process_single_frame(images_copy, i) diff --git a/konabot/plugins/fx_process/fx_handle.py b/konabot/plugins/fx_process/fx_handle.py index 17e6b66..7580387 100644 --- a/konabot/plugins/fx_process/fx_handle.py +++ b/konabot/plugins/fx_process/fx_handle.py @@ -1071,8 +1071,6 @@ class ImageFilterImplement: if image.mode != 'RGBA': image = image.convert('RGBA') - width, height = image.size - arr = np.array(image) # 生成随机偏移 x_offset = random.randint(-max_offset, max_offset) y_offset = random.randint(-max_offset, max_offset)