diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py
index fec2f7663..645bb26bf 100644
--- a/src/PIL/GifImagePlugin.py
+++ b/src/PIL/GifImagePlugin.py
@@ -166,6 +166,7 @@ class GifImageFile(ImageFile.ImageFile):
         from copy import copy
         self.palette = copy(self.global_palette)
 
+        info = {}
         while True:
 
             s = self.fp.read(1)
@@ -184,8 +185,8 @@ class GifImageFile(ImageFile.ImageFile):
                     #
                     flags = i8(block[0])
                     if flags & 1:
-                        self.info["transparency"] = i8(block[3])
-                    self.info["duration"] = i16(block[1:3]) * 10
+                        info["transparency"] = i8(block[3])
+                    info["duration"] = i16(block[1:3]) * 10
 
                     # disposal method - find the value of bits 4 - 6
                     dispose_bits = 0b00011100 & flags
@@ -200,16 +201,16 @@ class GifImageFile(ImageFile.ImageFile):
                     #
                     # comment extension
                     #
-                    self.info["comment"] = block
+                    info["comment"] = block
                 elif i8(s) == 255:
                     #
                     # application extension
                     #
-                    self.info["extension"] = block, self.fp.tell()
+                    info["extension"] = block, self.fp.tell()
                     if block[:11] == b"NETSCAPE2.0":
                         block = self.data()
                         if len(block) >= 3 and i8(block[0]) == 1:
-                            self.info["loop"] = i16(block[1:3])
+                            info["loop"] = i16(block[1:3])
                 while self.data():
                     pass
 
@@ -268,6 +269,12 @@ class GifImageFile(ImageFile.ImageFile):
             # self.__fp = None
             raise EOFError
 
+        for k in ["transparency", "duration", "comment", "extension", "loop"]:
+            if k in info:
+                self.info[k] = info[k]
+            elif k in self.info:
+                del self.info[k]
+
         self.mode = "L"
         if self.palette:
             self.mode = "P"

TypeError: object of type 'NoneType' has no len()
### TypeError: object of type 'NoneType' has no len()

This image has a value "comment" is None. It raises that error.  

This is my PR 
https://github.com/python-pillow/Pillow/pull/3314

https://github.com/python-pillow/Pillow/blob/master/src/PIL/GifImagePlugin.py#L527
```python
>    if "comment" in im.encoderinfo and 1 <= len(im.encoderinfo["comment"]) <= 255:
E                  TypeError: object of type 'NoneType' has no len()

```


https://github.com/python-pillow/Pillow/blob/master/src/PIL/GifImagePlugin.py#L697

```python
    def _get_global_header(im, info):
        """Return a list of strings representing a GIF header"""
    
        # Header Block
        # http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp
    
        version = b"87a"
        for extensionKey in ["transparency", "duration", "loop", "comment"]:
            if info and extensionKey in info:
                if ((extensionKey == "duration" and info[extensionKey] == 0) or
>                  (extensionKey == "comment" and not (1 <= len(info[extensionKey]) <= 255))):
E                  TypeError: object of type 'NoneType' has no len()
```


```python
{'background': 160,
 'comment': None,
 'duration': 500,
 'optimize': True,
 'version': b'GIF89a'}
```

This code is reproducing that issue
```python
from PIL import Image
from io import BytesIO

filename = 'test.gif'


with open(filename, "rb") as fp:

    img = Image.open(fp)
    file_obj = BytesIO()

    print(img.info)

    getattr(img, "is_animated", False)

    print(img.info)

    img.save(file_obj, format="GIF")
```
![test2](https://user-images.githubusercontent.com/9821654/44784628-f9408780-ab96-11e8-9e9b-038467b6058a.gif)


diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py
index 086a0f5d0..917b36905 100644
--- a/Tests/test_file_gif.py
+++ b/Tests/test_file_gif.py
@@ -134,13 +134,15 @@ class TestFileGif(PillowTestCase):
         # Multiframe image
         im = Image.open("Tests/images/dispose_bgnd.gif")
 
+        info = im.info.copy()
+
         out = self.tempfile('temp.gif')
         im.save(out, save_all=True)
         reread = Image.open(out)
 
         for header in important_headers:
             self.assertEqual(
-                im.info[header],
+                info[header],
                 reread.info[header]
             )
 
@@ -207,6 +209,15 @@ class TestFileGif(PillowTestCase):
         except EOFError:
             self.assertEqual(framecount, 5)
 
+    def test_seek_info(self):
+        im = Image.open("Tests/images/iss634.gif")
+        info = im.info.copy()
+
+        im.seek(1)
+        im.seek(0)
+
+        self.assertEqual(im.info, info)
+
     def test_n_frames(self):
         for path, n_frames in [
             [TEST_GIF, 1],

pip install -e .[dev]
parse_log_pytest
requirements.txt
apt-get update apt-get install -y gcc libjpeg-dev zlib1g-dev libtiff5-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev libharfbuzz-dev libfribidi-dev libxcb1-dev
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
babel==2.17.0
blessed==1.20.0
build==1.2.2.post1
certifi==2025.1.31
charset-normalizer==3.4.1
check-manifest==0.50
cov-core==1.15.0
coverage==7.8.0
coveralls==4.0.1
docopt==0.6.2
docutils==0.21.2
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
jarn.viewdoc==2.7
Jinja2==3.1.6
MarkupSafe==3.0.2
olefile==0.47
packaging==24.2
-e git+https://github.com/python-pillow/Pillow.git@5af867df4a7a13a924590af49d24030225b5c93e#egg=Pillow
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
Pygments==2.19.1
pyproject_hooks==1.2.0
pyroma==4.2
pytest==8.3.5
pytest-cov==6.0.0
pytz==2025.2
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
trove-classifiers==2025.3.19.19
urllib3==2.3.0
wcwidth==0.2.13
zipp==3.21.0

name: Pillow
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - babel==2.17.0
      - blessed==1.20.0
      - build==1.2.2.post1
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - check-manifest==0.50
      - cov-core==1.15.0
      - coverage==7.8.0
      - coveralls==4.0.1
      - docopt==0.6.2
      - docutils==0.21.2
      - exceptiongroup==1.2.2
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - jarn-viewdoc==2.7
      - jinja2==3.1.6
      - markupsafe==3.0.2
      - olefile==0.47
      - packaging==24.2
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - pygments==2.19.1
      - pyproject-hooks==1.2.0
      - pyroma==4.2
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytz==2025.2
      - requests==2.32.3
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinx-rtd-theme==3.0.2
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - tomli==2.2.1
      - trove-classifiers==2025.3.19.19
      - urllib3==2.3.0
      - wcwidth==0.2.13
      - zipp==3.21.0
prefix: /opt/conda/envs/Pillow

Tests/test_file_gif.py::TestFileGif::test_seek_info Tests/test_file_gif.py::TestFileGif::test_transparent_optimize Tests/test_file_gif.py::TestFileGif::test_version
Tests/test_file_gif.py::TestFileGif::test_append_images Tests/test_file_gif.py::TestFileGif::test_background Tests/test_file_gif.py::TestFileGif::test_bbox Tests/test_file_gif.py::TestFileGif::test_comment Tests/test_file_gif.py::TestFileGif::test_dispose_background Tests/test_file_gif.py::TestFileGif::test_dispose_none Tests/test_file_gif.py::TestFileGif::test_dispose_previous Tests/test_file_gif.py::TestFileGif::test_duration Tests/test_file_gif.py::TestFileGif::test_eoferror Tests/test_file_gif.py::TestFileGif::test_getdata Tests/test_file_gif.py::TestFileGif::test_headers_saving_for_animated_gifs Tests/test_file_gif.py::TestFileGif::test_identical_frames Tests/test_file_gif.py::TestFileGif::test_invalid_file Tests/test_file_gif.py::TestFileGif::test_iss634 Tests/test_file_gif.py::TestFileGif::test_lzw_bits Tests/test_file_gif.py::TestFileGif::test_multiple_duration Tests/test_file_gif.py::TestFileGif::test_n_frames Tests/test_file_gif.py::TestFileGif::test_number_of_loops Tests/test_file_gif.py::TestFileGif::test_optimize Tests/test_file_gif.py::TestFileGif::test_optimize_correctness Tests/test_file_gif.py::TestFileGif::test_optimize_full_l Tests/test_file_gif.py::TestFileGif::test_palette_434 Tests/test_file_gif.py::TestFileGif::test_palette_handling Tests/test_file_gif.py::TestFileGif::test_palette_save_ImagePalette Tests/test_file_gif.py::TestFileGif::test_palette_save_L Tests/test_file_gif.py::TestFileGif::test_palette_save_P Tests/test_file_gif.py::TestFileGif::test_roundtrip Tests/test_file_gif.py::TestFileGif::test_roundtrip2 Tests/test_file_gif.py::TestFileGif::test_roundtrip_save_all Tests/test_file_gif.py::TestFileGif::test_sanity Tests/test_file_gif.py::TestFileGif::test_save_I Tests/test_file_gif.py::TestFileGif::test_save_dispose Tests/test_file_gif.py::TestFileGif::test_seek
src/PIL/GifImagePlugin.py
src/PIL/GifImagePlugin.py