Skip to content

Conversation

@benzkji
Copy link
Contributor

@benzkji benzkji commented Jan 7, 2025

@jrief @SmileyChris somehow the FrameAware wrapper did not always preserve the mode.

I was thinking about adding a "THUMBNAIL_PRESERVE_ANIMATIONS = False", so one can easily completly disable animated stuff. Even when not saving the frames, they are currently processed anyway, thus running into potential performance issues.

@benzkji
Copy link
Contributor Author

benzkji commented Jan 8, 2025

@jrief @SmileyChris to be clear, this is an somewhat urgent bugfix, for a regression (see #653 ) that was introduced by my animated formats support PR that was merged for version 2.10. THUMBNAIL_PRESERVE_ANIMATIONS is for later.

@philippemilink
Copy link

Can we expect this PR to be merged soon and a release to be published, please?

@benzkji
Copy link
Contributor Author

benzkji commented May 7, 2025

Let's see if @SmileyChris or @jrief see this.

@benkonrath
Copy link
Contributor

@benzkji Quick question about this fix: I noticed that the resulting thumbnail is not animated for animated mode P GIFs. You can see this by replacing the last line in the test with this:

            # ...
            thumb = t.get_thumbnail({'size': (500, 50), 'crop': True})
            self.assertTrue(getattr(thumb.image, "is_animated", False))

It looks like to_return = to_return.convert(new_frames[0].mode) removes the animation on the latest version of Pillow (pillow==11.2.1). Is this the expected result?

I've set THUMBNAIL_IMAGE_SAVE_OPTIONS correctly, e.g.:

THUMBNAIL_IMAGE_SAVE_OPTIONS = {
    # ...
    "PNG": {
        "save_all": True,
    },
    "GIF": {
        "save_all": True,
    },
}

I've also tested with animated PNGs and that is working. Any idea?

@benzkji
Copy link
Contributor Author

benzkji commented Jun 8, 2025

@benkonrath yes. It is the workaround. I've not found a way to correctly process the example GIF from this PR, so I thought, better strip animations and have something working. I was not able to spend a lot of time on the problem though, I'm sure there is a solution. But Pillow is sometimes tricky, I must admit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants