In Image.Image.seek(), clear core image if mode or size has changed
Addresses #8439
#8390 stopped load_prepare() from recreating the core image instance if the mode or size had changed, as might happen at the end of a seek() operation. After that PR, this was no longer needed for any of our internal plugins.
However, #8439 has pointed out that this would still be helpful for external plugins. Rather than reverting the change, this PR suggests that external plugins can call super().seek() at the end of their seek() methods. That will then clear the core image instance if the mode or size has changed, allowing load_prepare() to detect that a new core image is needed.
The advantage of this over a simple revert is that if a user calls seek() on an image, but not load(), then the core image instance is discarded.
What about TiffImagePlugin? Can we call super().seek() there?
What about TiffImagePlugin? Can we call super().seek() there?
No, because at the end of TiffImagePlugin's seek(), the normal size isn't used - self._tile_size is.
I don't think this is the neatest API change I've ever suggested, so if there isn't much interest, I'm happy for this to be closed.