Include filename in ImageFile state by radarhere · Pull Request #8859 · python-pillow/Pillow

Resolves #8857

Like #8476, this adds another item to the pickled state. When an ImageFile instance is pickled and unpickled, it will now retain the image filename.

In thinking about the image filename, I've also added a change for the #8852 functionality - since the user might open the file with an absolute path, and then save it to a relative path, both targeting the same file, let's compare the absolute versions of the filename paths.