new fx
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-12-10 17:22:12 +08:00
parent 9904653cc6
commit a829f035b3
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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)