fdintino / pillow-avif-plugin

A pillow plugin that adds avif support via libavif
BSD 2-Clause "Simplified" License
77 stars 12 forks source link

Cannot save single image from sequence? #1

Closed cdgriffith closed 3 years ago

cdgriffith commented 3 years ago

First off, thanks for the great plugin, loving the support for the new format! The fact it includes sequences is amazing!

One thing I just ran into, if I am trying to save a still from a GIF the traditional way it doesn't work.

from PIL import Image
import pillow_avif

image = Image.open("test.gif")
image.seek(0)
image.thumbnail((64, 64))

# works
# image.save("test.png")

# saves as sequence 
image.save("test.avif")
fdintino commented 3 years ago

You'll need to instead do image.save("test.avif", save_all=True), same as you would when saving an animated gif

cdgriffith commented 3 years ago

Right, I am specifically trying NOT to save it animated. Just a single frame from it.

cdgriffith commented 3 years ago

For example, if I use this short GIF as "incoming.gif"

incoming

And I want to save a single frame from it, say right back to a .gif, but this time not animated.

from PIL import Image
import pillow_avif

image = Image.open("incoming.gif")
image.seek(0)
image.save("D:\\output.gif")

Works as expected: output

If I try that same with avif, it is still animated.

from PIL import Image
import pillow_avif

image = Image.open("incoming.gif")
image.seek(0)
image.save("D:\\output.avif", qmax=24)

(zipped because github hasn't embraced the future yet) output.zip

fdintino commented 3 years ago

Oh, thanks for the clarification! That does indeed seem like a bug.

fdintino commented 3 years ago

This should be fixed in the 1.0.1 release, which I just uploaded to PyPi. Let me know if you run into any issues.

cdgriffith commented 3 years ago

You are fast! Works as expected, thanks!