fix(agent): load huge images — disable PIL decompression-bomb guard
Trusted local library, not an upload surface, so a legitimately large image (90–95M px, operator-flagged) must load. PIL only WARNS at the 89M-px default but RAISES DecompressionBombError at ~179M px, which would fail those jobs. Set Image.MAX_IMAGE_PIXELS = None. (The agent works off individual extracted files — curator's archive_extractor unpacks zip/cbz/rar/7z at import — so this is about big single images, not archives.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
This commit is contained in:
@@ -13,6 +13,13 @@ from PIL import Image, ImageFile
|
||||
# and would otherwise fail the job 3× then error (operator-flagged 2026-06-30).
|
||||
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||
|
||||
# Disable PIL's decompression-bomb guard: this is a TRUSTED local library, not an
|
||||
# untrusted upload surface, so a legitimately huge image (high-res scans/prints,
|
||||
# 90M+ pixels) must load. The default 89M-pixel limit only WARNS, but PIL raises
|
||||
# DecompressionBombError at 2× (~179M px) — which would fail those jobs outright
|
||||
# (operator-flagged 2026-06-30, images of 90–95M px).
|
||||
Image.MAX_IMAGE_PIXELS = None
|
||||
|
||||
|
||||
def is_video(mime: str) -> bool:
|
||||
return bool(mime) and (mime.startswith("video/") or mime in {"image/gif"})
|
||||
|
||||
Reference in New Issue
Block a user