diff --git a/src/PIL/MpoImagePlugin.py b/src/PIL/MpoImagePlugin.py
--- a/src/PIL/MpoImagePlugin.py
+++ b/src/PIL/MpoImagePlugin.py
@@ -46,6 +46,7 @@ def _open(self):
         self._after_jpeg_open()
 
     def _after_jpeg_open(self, mpheader=None):
+        self._initial_size = self.size
         self.mpinfo = mpheader if mpheader is not None else self._getmp()
         self.n_frames = self.mpinfo[0xB001]
         self.__mpoffsets = [
@@ -77,6 +78,7 @@ def seek(self, frame):
         segment = self.fp.read(2)
         if not segment:
             raise ValueError("No data found for frame")
+        self._size = self._initial_size
         if i16(segment) == 0xFFE1:  # APP1
             n = i16(self.fp.read(2)) - 2
             self.info["exif"] = ImageFile._safe_read(self.fp, n)

diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py
--- a/Tests/test_file_mpo.py
+++ b/Tests/test_file_mpo.py
@@ -85,6 +85,9 @@ def test_frame_size():
         im.seek(1)
         assert im.size == (680, 480)
 
+        im.seek(0)
+        assert im.size == (640, 480)
+
 
 def test_ignore_frame_size():
     # Ignore the different size of the second frame

Cannot modify the first frame of a MPO with asymmetric sized frames after seek
### What did you do?
Did a seek(1) to the second frame followed by a seek(0) back to the first, and a transpose

### What did you expect to happen?

The transpose

### What actually happened?

Segmentation fault: 11

### What are your OS, Python and Pillow versions?

* OS: OSX 10.15.7 and Ubuntu 20.04
* Python: 3.8.11 and 3.10.2
* Pillow: 9.0.1

This is an edge case issue with images created by the Nikon coolpix 500b (and possibly others), which appears to embed a couple "thumbnails" in the image files. Pillow (reasonably) detects this as a 3-frame MPO. For some reason, however, seeking back to the first frame and trying to modify it after seeking to any other frame crashes with a seg fault.

For the example below I used this image (not sure on the licensing, just the first I googled):
https://img.photographyblog.com/reviews/nikon_coolpix_b500/photos/nikon_coolpix_b500_02.jpg

```python
from PIL import Image
im = Image.open('nikon_coolpix_b500_02.jpg')
im.seek(1)
im.seek(0)
im.transpose(Image.FLIP_LEFT_RIGHT) # => Segment fault: 11
```

If it helps, I noticed that the `im.size` doesn't update after the `seek(0)` back to the first frame, even though `tell` reports the correct frame:
```python
im = Image.open('nikon_coolpix_b500_02.jpg')
im.size #  =>  (4608, 3456)
im.seek(1)
im.size #  =>  (640, 480)
im.seek(0)
im.size #  =>  (640, 480)
im.tell() # => 0
```
For my particular case, the problematic usage was some legacy code trying to detect animations that is better handled by checking `n_frames`, so I was able to work around it. Mainly documenting the issue in case anyone else runs into it.
