Skip to content

Commit b93b305

Browse files
authored
docs: note Pillow DecompressionBombError in load_img() (#23376)
Document that keras.utils.load_img() inherits Pillow's MAX_IMAGE_PIXELS limit and may raise DecompressionBombError for oversized images. Closes #23317.
1 parent 4b05110 commit b93b305

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

keras/src/utils/image_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ def load_img(
234234
235235
Returns:
236236
A PIL Image instance.
237+
238+
Note:
239+
This function uses Pillow (`PIL.Image`) for decoding and therefore
240+
inherits Pillow's decompression-bomb protection. Images whose pixel
241+
count exceeds `PIL.Image.MAX_IMAGE_PIXELS` raise
242+
`PIL.Image.DecompressionBombError`. To load larger images, raise or
243+
disable that limit (see the
244+
[Pillow documentation](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open)).
237245
"""
238246
if pil_image is None:
239247
raise ImportError(

0 commit comments

Comments
 (0)