Skip to content

Read and write some gifs wrong, with "artifacts". "optimize" doesn't work #2543

@pl7ofit

Description

@pl7ofit

What did you do?

I read each frame of the gif, and then write them to a file.

What did you expect to happen?

That everything will work without a headache =)

What actually happened?

Some gif files wrote with artifacts and "optimize" doesn't work
pic2.gif
Gif №2

pic6.gif
Gif №6

I think compare successful and unsuccessful gifs will be right. Therefore I downloaded the gifs archive
"Bad" and "good" gifs tar archive

What versions of Pillow and Python are you using?

Pillow-4.1.1-cp35-cp35m-manylinux1_x86_64.whl
Python 3.5.2
Ubuntu 16.04.2 amd64

from PIL import Image, ImageChops, ImageSequence

f = Image.open('file.gif')
frames = []
framesIterator = ImageSequence.Iterator(f)
for frame in [ frame.copy() for frame in framesIterator ]: frames.append(frame)
frame.save('out.gif', save_all=True, optimize=True, append_images=frames)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.GIF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions