fix: handle PNG files with MPO metadata in input image processing

This commit is contained in:
Chengwei Ouyang
2025-12-08 17:02:23 +08:00
parent d27fafbb00
commit 6857027895
+11 -2
View File
@@ -101,8 +101,17 @@ class ShellAgentPluginInputImage:
w, h = None, None
excluded_formats = ['MPO']
for i in ImageSequence.Iterator(img):
# Determine frames to process
# Some PNG files contain MPO EXIF metadata causing PIL to misidentify them as MPO
# When this happens, ImageSequence.Iterator fails with "not a JPEG file"
try:
frames = list(ImageSequence.Iterator(img))
except SyntaxError:
# Fallback for misidentified formats (e.g., PNG with MPO metadata)
frames = [img]
for i in frames:
i = node_helpers.pillow(ImageOps.exif_transpose, i)
if i.mode == 'I':