-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using seek to skip more than one frame with FliImageFile only shows the pixels changed that frame #2649
Comments
Minimal example to reproduce: >>> from PIL import Image
>>> im = Image.open("a.fli")
>>> im.seek(50)
>>> im.show() This works: >>> im2 = Image.open("a.fli")
>>> im2.load()
<PixelAccess object at 0x10f6d5c30>
>>> im2.seek(50)
>>> im2.show()
...
And some other plugins don't |
@hugovk It doesn't though, look at the differences in the file. The shoe is not complete in the one that you posted. I think this may need to do the same thing that GIF does because of delta compression, in that a seek to n+1 is going to require all of the 0..n frames to be loaded first. |
@hugovk, @wiredfool : (Referring to the images in the second post) The shoe is incomplete and the item in the center of the conveyor belt shouldn't be there at all in frame 50 (or actually, I guess it should be on the far left by that frame). Isn't GIF actually loading the previous frame's self.tile at the top of _seek instead loading the new frame's self.tile information at the end of _seek? I tried doing something similar here and was a frame behind. |
@adambiser Yeah, I think the gif plugin is a frame behind, to preserve the semantics of 'lazy' loading. At the end of the seek(N) call, you're going to have the image reflect frame n-1, and calling load on it will load frame N. IIRC there's even some seek-forward/back silliness there as well. |
@wiredfool True. FliImageFile probably just needs that bit of code at the top of its _seek method, too. else:
# ensure that the previous frame was loaded
if not self.im:
self.load() |
I have created PR #3478 |
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.
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.
The text was updated successfully, but these errors were encountered: