In Python while unsing the PIL pillow library. When I open an image and call load on it do it still need to close it?
16:47 20 Apr 2026

When opening a image in Python using the PIL pillow library, assuming the image does not contain multiple frames with (e.g. a simple "jpeg") and then call .load() on it:

from PIL import Image

image = Image.open("some path")
image.load()

Can I just delete/reassign the reference to it and let the garbage collector take care of it instead of calling .close() on it? As instead of doing :

image.close()

Could i just do:

image = "some other thing"
# or
del image

And the memory will still be released via the garbage collector?

python python-imaging-library