We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Using seek to skip more than one frame with FliImageFile only shows the pixels changed that frame
### What did you do?
I opened a FLI file and used .seek(50) on the image before creating a PhotoImage to display it on a tix label.

### What did you expect to happen?
I expected to see the complete image.

### What actually happened?
I only saw the part of the image that had changed for that particular frame. The rest of the image is black.

### What versions of Pillow and Python are you using?
Python 3.6.2 on Windows 7 x64
Pillow: 4.2.1

I did find that if I hack in a call to self.load() in FliImageFile's _seek() method, the frame displays fully. I don't know if this is the best way to fix the issue.

```python
import PIL as pil
from PIL import Image,ImageTk,FliImagePlugin
import tkinter.tix as tix

class FliImageFile(FliImagePlugin.FliImageFile):
    def _seek(self, frame):
        FliImagePlugin.FliImageFile._seek(self, frame)
        # ensure that this frame is loaded
        self.load()

def createlabel(root, filename):
    label = tix.Label(root)
    label.original = Image.open(filename)
    label.original.seek(50) # Go to frame 50.
    label.photoimage = ImageTk.PhotoImage(label.original) # keep a reference!
    label.config(image=label.photoimage)
    return label

def main():
    root = tix.Tk()
    label1 = createlabel(root, 'a.fli')
    label1.pack()
    # Hack to replace PIL's FliImageFile with one that loads image data at
    # the end of each internal _seek() call.
    Image.OPEN[FliImagePlugin.FliImageFile.format] = (FliImageFile, Image.OPEN[FliImagePlugin.FliImageFile.format][1])
    label2 = createlabel(root, 'a.fli')
    label2.pack()
    root.mainloop()

main()
```
Using a.fli found at https://samples.libav.org/fli-flc/

Top image is what Pillow displays as-is. The bottom image uses my hack that loads the image at the end of _seek.

![fli-bug](https://user-images.githubusercontent.com/10321049/28949712-9eb3f24a-788c-11e7-8780-6931c971724d.png)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/PIL/FliImagePlugin.py`
Content:
```
1 #
2 # The Python Imaging Library.
3 # $Id$
4 #
5 # FLI/FLC file handling.
6 #
7 # History:
8 #       95-09-01 fl     Created
9 #       97-01-03 fl     Fixed parser, setup decoder tile
10 #       98-07-15 fl     Renamed offset attribute to avoid name clash
11 #
12 # Copyright (c) Secret Labs AB 1997-98.
13 # Copyright (c) Fredrik Lundh 1995-97.
14 #
15 # See the README file for information on usage and redistribution.
16 #
17 
18 
19 from . import Image, ImageFile, ImagePalette
20 from ._binary import i8, i16le as i16, i32le as i32, o8
21 
22 __version__ = "0.2"
23 
24 
25 #
26 # decoder
27 
28 def _accept(prefix):
29     return len(prefix) >= 6 and i16(prefix[4:6]) in [0xAF11, 0xAF12]
30 
31 
32 ##
33 # Image plugin for the FLI/FLC animation format.  Use the <b>seek</b>
34 # method to load individual frames.
35 
36 class FliImageFile(ImageFile.ImageFile):
37 
38     format = "FLI"
39     format_description = "Autodesk FLI/FLC Animation"
40     _close_exclusive_fp_after_loading = False
41 
42     def _open(self):
43 
44         # HEAD
45         s = self.fp.read(128)
46         magic = i16(s[4:6])
47         if not (magic in [0xAF11, 0xAF12] and
48                 i16(s[14:16]) in [0, 3] and  # flags
49                 s[20:22] == b"\x00\x00"):  # reserved
50             raise SyntaxError("not an FLI/FLC file")
51 
52         # frames
53         self.__framecount = i16(s[6:8])
54 
55         # image characteristics
56         self.mode = "P"
57         self._size = i16(s[8:10]), i16(s[10:12])
58 
59         # animation speed
60         duration = i32(s[16:20])
61         if magic == 0xAF11:
62             duration = (duration * 1000) // 70
63         self.info["duration"] = duration
64 
65         # look for palette
66         palette = [(a, a, a) for a in range(256)]
67 
68         s = self.fp.read(16)
69 
70         self.__offset = 128
71 
72         if i16(s[4:6]) == 0xF100:
73             # prefix chunk; ignore it
74             self.__offset = self.__offset + i32(s)
75             s = self.fp.read(16)
76 
77         if i16(s[4:6]) == 0xF1FA:
78             # look for palette chunk
79             s = self.fp.read(6)
80             if i16(s[4:6]) == 11:
81                 self._palette(palette, 2)
82             elif i16(s[4:6]) == 4:
83                 self._palette(palette, 0)
84 
85         palette = [o8(r)+o8(g)+o8(b) for (r, g, b) in palette]
86         self.palette = ImagePalette.raw("RGB", b"".join(palette))
87 
88         # set things up to decode first frame
89         self.__frame = -1
90         self.__fp = self.fp
91         self.__rewind = self.fp.tell()
92         self.seek(0)
93 
94     def _palette(self, palette, shift):
95         # load palette
96 
97         i = 0
98         for e in range(i16(self.fp.read(2))):
99             s = self.fp.read(2)
100             i = i + i8(s[0])
101             n = i8(s[1])
102             if n == 0:
103                 n = 256
104             s = self.fp.read(n * 3)
105             for n in range(0, len(s), 3):
106                 r = i8(s[n]) << shift
107                 g = i8(s[n+1]) << shift
108                 b = i8(s[n+2]) << shift
109                 palette[i] = (r, g, b)
110                 i += 1
111 
112     @property
113     def n_frames(self):
114         return self.__framecount
115 
116     @property
117     def is_animated(self):
118         return self.__framecount > 1
119 
120     def seek(self, frame):
121         if not self._seek_check(frame):
122             return
123         if frame < self.__frame:
124             self._seek(0)
125 
126         for f in range(self.__frame + 1, frame + 1):
127             self._seek(f)
128 
129     def _seek(self, frame):
130         if frame == 0:
131             self.__frame = -1
132             self.__fp.seek(self.__rewind)
133             self.__offset = 128
134 
135         if frame != self.__frame + 1:
136             raise ValueError("cannot seek to frame %d" % frame)
137         self.__frame = frame
138 
139         # move to next frame
140         self.fp = self.__fp
141         self.fp.seek(self.__offset)
142 
143         s = self.fp.read(4)
144         if not s:
145             raise EOFError
146 
147         framesize = i32(s)
148 
149         self.decodermaxblock = framesize
150         self.tile = [("fli", (0, 0)+self.size, self.__offset, None)]
151 
152         self.__offset += framesize
153 
154     def tell(self):
155         return self.__frame
156 
157 
158 #
159 # registry
160 
161 Image.register_open(FliImageFile.format, FliImageFile, _accept)
162 
163 Image.register_extensions(FliImageFile.format, [".fli", ".flc"])
164
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/PIL/FliImagePlugin.py b/src/PIL/FliImagePlugin.py
--- a/src/PIL/FliImagePlugin.py
+++ b/src/PIL/FliImagePlugin.py
@@ -131,6 +131,9 @@
             self.__frame = -1
             self.__fp.seek(self.__rewind)
             self.__offset = 128
+        else:
+            # ensure that the previous frame was loaded
+            self.load()
 
         if frame != self.__frame + 1:
             raise ValueError("cannot seek to frame %d" % frame)

{"golden_diff": "diff --git a/src/PIL/FliImagePlugin.py b/src/PIL/FliImagePlugin.py\n--- a/src/PIL/FliImagePlugin.py\n+++ b/src/PIL/FliImagePlugin.py\n@@ -131,6 +131,9 @@\n             self.__frame = -1\n             self.__fp.seek(self.__rewind)\n             self.__offset = 128\n+        else:\n+            # ensure that the previous frame was loaded\n+            self.load()\n \n         if frame != self.__frame + 1:\n             raise ValueError(\"cannot seek to frame %d\" % frame)\n", "issue": "Using seek to skip more than one frame with FliImageFile only shows the pixels changed that frame\n### What did you do?\r\nI opened a FLI file and used .seek(50) on the image before creating a PhotoImage to display it on a tix label.\r\n\r\n### What did you expect to happen?\r\nI expected to see the complete image.\r\n\r\n### What actually happened?\r\nI only saw the part of the image that had changed for that particular frame. The rest of the image is black.\r\n\r\n### What versions of Pillow and Python are you using?\r\nPython 3.6.2 on Windows 7 x64\r\nPillow: 4.2.1\r\n\r\nI did find that if I hack in a call to self.load() in FliImageFile's _seek() method, the frame displays fully. I don't know if this is the best way to fix the issue.\r\n\r\n```python\r\nimport PIL as pil\r\nfrom PIL import Image,ImageTk,FliImagePlugin\r\nimport tkinter.tix as tix\r\n\r\nclass FliImageFile(FliImagePlugin.FliImageFile):\r\n    def _seek(self, frame):\r\n        FliImagePlugin.FliImageFile._seek(self, frame)\r\n        # ensure that this frame is loaded\r\n        self.load()\r\n\r\ndef createlabel(root, filename):\r\n    label = tix.Label(root)\r\n    label.original = Image.open(filename)\r\n    label.original.seek(50) # Go to frame 50.\r\n    label.photoimage = ImageTk.PhotoImage(label.original) # keep a reference!\r\n    label.config(image=label.photoimage)\r\n    return label\r\n\r\ndef main():\r\n    root = tix.Tk()\r\n    label1 = createlabel(root, 'a.fli')\r\n    label1.pack()\r\n    # Hack to replace PIL's FliImageFile with one that loads image data at\r\n    # the end of each internal _seek() call.\r\n    Image.OPEN[FliImagePlugin.FliImageFile.format] = (FliImageFile, Image.OPEN[FliImagePlugin.FliImageFile.format][1])\r\n    label2 = createlabel(root, 'a.fli')\r\n    label2.pack()\r\n    root.mainloop()\r\n\r\nmain()\r\n```\r\nUsing a.fli found at https://samples.libav.org/fli-flc/\r\n\r\nTop image is what Pillow displays as-is. The bottom image uses my hack that loads the image at the end of _seek.\r\n\r\n![fli-bug](https://user-images.githubusercontent.com/10321049/28949712-9eb3f24a-788c-11e7-8780-6931c971724d.png)\n", "before_files": [{"content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# FLI/FLC file handling.\n#\n# History:\n#       95-09-01 fl     Created\n#       97-01-03 fl     Fixed parser, setup decoder tile\n#       98-07-15 fl     Renamed offset attribute to avoid name clash\n#\n# Copyright (c) Secret Labs AB 1997-98.\n# Copyright (c) Fredrik Lundh 1995-97.\n#\n# See the README file for information on usage and redistribution.\n#\n\n\nfrom . import Image, ImageFile, ImagePalette\nfrom ._binary import i8, i16le as i16, i32le as i32, o8\n\n__version__ = \"0.2\"\n\n\n#\n# decoder\n\ndef _accept(prefix):\n    return len(prefix) >= 6 and i16(prefix[4:6]) in [0xAF11, 0xAF12]\n\n\n##\n# Image plugin for the FLI/FLC animation format.  Use the <b>seek</b>\n# method to load individual frames.\n\nclass FliImageFile(ImageFile.ImageFile):\n\n    format = \"FLI\"\n    format_description = \"Autodesk FLI/FLC Animation\"\n    _close_exclusive_fp_after_loading = False\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(128)\n        magic = i16(s[4:6])\n        if not (magic in [0xAF11, 0xAF12] and\n                i16(s[14:16]) in [0, 3] and  # flags\n                s[20:22] == b\"\\x00\\x00\"):  # reserved\n            raise SyntaxError(\"not an FLI/FLC file\")\n\n        # frames\n        self.__framecount = i16(s[6:8])\n\n        # image characteristics\n        self.mode = \"P\"\n        self._size = i16(s[8:10]), i16(s[10:12])\n\n        # animation speed\n        duration = i32(s[16:20])\n        if magic == 0xAF11:\n            duration = (duration * 1000) // 70\n        self.info[\"duration\"] = duration\n\n        # look for palette\n        palette = [(a, a, a) for a in range(256)]\n\n        s = self.fp.read(16)\n\n        self.__offset = 128\n\n        if i16(s[4:6]) == 0xF100:\n            # prefix chunk; ignore it\n            self.__offset = self.__offset + i32(s)\n            s = self.fp.read(16)\n\n        if i16(s[4:6]) == 0xF1FA:\n            # look for palette chunk\n            s = self.fp.read(6)\n            if i16(s[4:6]) == 11:\n                self._palette(palette, 2)\n            elif i16(s[4:6]) == 4:\n                self._palette(palette, 0)\n\n        palette = [o8(r)+o8(g)+o8(b) for (r, g, b) in palette]\n        self.palette = ImagePalette.raw(\"RGB\", b\"\".join(palette))\n\n        # set things up to decode first frame\n        self.__frame = -1\n        self.__fp = self.fp\n        self.__rewind = self.fp.tell()\n        self.seek(0)\n\n    def _palette(self, palette, shift):\n        # load palette\n\n        i = 0\n        for e in range(i16(self.fp.read(2))):\n            s = self.fp.read(2)\n            i = i + i8(s[0])\n            n = i8(s[1])\n            if n == 0:\n                n = 256\n            s = self.fp.read(n * 3)\n            for n in range(0, len(s), 3):\n                r = i8(s[n]) << shift\n                g = i8(s[n+1]) << shift\n                b = i8(s[n+2]) << shift\n                palette[i] = (r, g, b)\n                i += 1\n\n    @property\n    def n_frames(self):\n        return self.__framecount\n\n    @property\n    def is_animated(self):\n        return self.__framecount > 1\n\n    def seek(self, frame):\n        if not self._seek_check(frame):\n            return\n        if frame < self.__frame:\n            self._seek(0)\n\n        for f in range(self.__frame + 1, frame + 1):\n            self._seek(f)\n\n    def _seek(self, frame):\n        if frame == 0:\n            self.__frame = -1\n            self.__fp.seek(self.__rewind)\n            self.__offset = 128\n\n        if frame != self.__frame + 1:\n            raise ValueError(\"cannot seek to frame %d\" % frame)\n        self.__frame = frame\n\n        # move to next frame\n        self.fp = self.__fp\n        self.fp.seek(self.__offset)\n\n        s = self.fp.read(4)\n        if not s:\n            raise EOFError\n\n        framesize = i32(s)\n\n        self.decodermaxblock = framesize\n        self.tile = [(\"fli\", (0, 0)+self.size, self.__offset, None)]\n\n        self.__offset += framesize\n\n    def tell(self):\n        return self.__frame\n\n\n#\n# registry\n\nImage.register_open(FliImageFile.format, FliImageFile, _accept)\n\nImage.register_extensions(FliImageFile.format, [\".fli\", \".flc\"])\n", "path": "src/PIL/FliImagePlugin.py"}], "after_files": [{"content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# FLI/FLC file handling.\n#\n# History:\n#       95-09-01 fl     Created\n#       97-01-03 fl     Fixed parser, setup decoder tile\n#       98-07-15 fl     Renamed offset attribute to avoid name clash\n#\n# Copyright (c) Secret Labs AB 1997-98.\n# Copyright (c) Fredrik Lundh 1995-97.\n#\n# See the README file for information on usage and redistribution.\n#\n\n\nfrom . import Image, ImageFile, ImagePalette\nfrom ._binary import i8, i16le as i16, i32le as i32, o8\n\n__version__ = \"0.2\"\n\n\n#\n# decoder\n\ndef _accept(prefix):\n    return len(prefix) >= 6 and i16(prefix[4:6]) in [0xAF11, 0xAF12]\n\n\n##\n# Image plugin for the FLI/FLC animation format.  Use the <b>seek</b>\n# method to load individual frames.\n\nclass FliImageFile(ImageFile.ImageFile):\n\n    format = \"FLI\"\n    format_description = \"Autodesk FLI/FLC Animation\"\n    _close_exclusive_fp_after_loading = False\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(128)\n        magic = i16(s[4:6])\n        if not (magic in [0xAF11, 0xAF12] and\n                i16(s[14:16]) in [0, 3] and  # flags\n                s[20:22] == b\"\\x00\\x00\"):  # reserved\n            raise SyntaxError(\"not an FLI/FLC file\")\n\n        # frames\n        self.__framecount = i16(s[6:8])\n\n        # image characteristics\n        self.mode = \"P\"\n        self._size = i16(s[8:10]), i16(s[10:12])\n\n        # animation speed\n        duration = i32(s[16:20])\n        if magic == 0xAF11:\n            duration = (duration * 1000) // 70\n        self.info[\"duration\"] = duration\n\n        # look for palette\n        palette = [(a, a, a) for a in range(256)]\n\n        s = self.fp.read(16)\n\n        self.__offset = 128\n\n        if i16(s[4:6]) == 0xF100:\n            # prefix chunk; ignore it\n            self.__offset = self.__offset + i32(s)\n            s = self.fp.read(16)\n\n        if i16(s[4:6]) == 0xF1FA:\n            # look for palette chunk\n            s = self.fp.read(6)\n            if i16(s[4:6]) == 11:\n                self._palette(palette, 2)\n            elif i16(s[4:6]) == 4:\n                self._palette(palette, 0)\n\n        palette = [o8(r)+o8(g)+o8(b) for (r, g, b) in palette]\n        self.palette = ImagePalette.raw(\"RGB\", b\"\".join(palette))\n\n        # set things up to decode first frame\n        self.__frame = -1\n        self.__fp = self.fp\n        self.__rewind = self.fp.tell()\n        self.seek(0)\n\n    def _palette(self, palette, shift):\n        # load palette\n\n        i = 0\n        for e in range(i16(self.fp.read(2))):\n            s = self.fp.read(2)\n            i = i + i8(s[0])\n            n = i8(s[1])\n            if n == 0:\n                n = 256\n            s = self.fp.read(n * 3)\n            for n in range(0, len(s), 3):\n                r = i8(s[n]) << shift\n                g = i8(s[n+1]) << shift\n                b = i8(s[n+2]) << shift\n                palette[i] = (r, g, b)\n                i += 1\n\n    @property\n    def n_frames(self):\n        return self.__framecount\n\n    @property\n    def is_animated(self):\n        return self.__framecount > 1\n\n    def seek(self, frame):\n        if not self._seek_check(frame):\n            return\n        if frame < self.__frame:\n            self._seek(0)\n\n        for f in range(self.__frame + 1, frame + 1):\n            self._seek(f)\n\n    def _seek(self, frame):\n        if frame == 0:\n            self.__frame = -1\n            self.__fp.seek(self.__rewind)\n            self.__offset = 128\n        else:\n            # ensure that the previous frame was loaded\n            self.load()\n\n        if frame != self.__frame + 1:\n            raise ValueError(\"cannot seek to frame %d\" % frame)\n        self.__frame = frame\n\n        # move to next frame\n        self.fp = self.__fp\n        self.fp.seek(self.__offset)\n\n        s = self.fp.read(4)\n        if not s:\n            raise EOFError\n\n        framesize = i32(s)\n\n        self.decodermaxblock = framesize\n        self.tile = [(\"fli\", (0, 0)+self.size, self.__offset, None)]\n\n        self.__offset += framesize\n\n    def tell(self):\n        return self.__frame\n\n\n#\n# registry\n\nImage.register_open(FliImageFile.format, FliImageFile, _accept)\n\nImage.register_extensions(FliImageFile.format, [\".fli\", \".flc\"])\n", "path": "src/PIL/FliImagePlugin.py"}]}