Moved get_child_images() to ImageFile by radarhere · Pull Request #8689 · python-pillow/Pillow

Images that are not ImageFiles

>>> from PIL import Image
>>> im = Image.new("RGB", (1, 1))
>>> im.get_child_images()
[]

would start failing.

>>> im.get_child_images()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Image' object has no attribute 'get_child_images'

However, I would suggest that is more helpful than an apparently-successful empty list, since an Image by itself will never return any child images - for example, if I open an image as an ImageFile, and then copy() to turn it into an Image, there is an error.

>>> from PIL import Image
>>> im = Image.open("Tests/images/flower.jpg")
>>> im.get_child_images()
[<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=160x120 at 0x103ACA970>]
>>> im.copy().get_child_images()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PIL/Image.py", line 1574, in get_child_images
    current_offset = self.fp.tell()
AttributeError: 'Image' object has no attribute 'fp'

That would now change to

>>> im.copy().get_child_images()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Image' object has no attribute 'get_child_images'

which again, I think is more helpful.