Skip to content
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

Frame loss in GIF #5949

Closed
ghost opened this issue Jan 9, 2022 · 1 comment
Closed

Frame loss in GIF #5949

ghost opened this issue Jan 9, 2022 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Jan 9, 2022

What did you do?

I try to extract frame from a gif

What did you expect to happen?

I expect to get png or jpg image.

What actually happened?

I got the same gif but in other mode.

What are your OS, Python and Pillow versions?

  • OS: Windows
  • Python: 3.10.1
  • Pillow: 9.0.0

image
image

@ghost ghost closed this as completed Jan 9, 2022
@ghost ghost reopened this Jan 9, 2022
@radarhere
Copy link
Member

Hi.

Since Pillow 9.0 / #5857, once you seek past the first GIF frame, the mode will change to RGB or RGBA, yes. This is because P mode can only handle up to 256 colors, and once you go past the first frame, there may be more colors than that.

The fact that avatar is a GifImageFile instance reflects the fact that you opened a GIF. I highly doubt that you actually need avatar to be a PngImageFile or JpegImageFile instance to accomplish your goal. If you think otherwise, please provide some more comments and we can discuss this further.

If you would like to create a PNG or JPG from your GIF, you can just run avatar.save("out.jpg") or avatar.save("out.png").

@radarhere radarhere added the GIF label Jan 10, 2022
@ghost ghost closed this as completed Jan 10, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant