Skip to content

Converting animated gif to webp produces faulty images #4313

@madeddy

Description

@madeddy

What did you do?

Converted some animated gifs to animated webp. Used different qualtity settings.

What did you expect to happen?

Getting a identical converted image. Beside the(logical) format and possible size change.

What actually happened?

Webp outputs are defect. Three different problems appear.
The output images:

  1. play too slow
  2. do not play in a image viewer (gwenview for me OR in Pillow's Image.show() method)
  3. some images have after convert also visual defects like wrong pixels (flickering and line style artifacts)

ps.: Converting the same images with the same settings with webp CLI tools works without issues.

What are your OS, Python and Pillow versions?

  • OS: Kubuntu 18.04.3
  • Python: 3.6.9
  • Pillow: 6.2.1

Code example

Python:

from pathlib import Path as pt
from PIL import Image

src_f = pt("animated.gif")
dst_f = pt(src_f).with_suffix('.webp')

# other used quality settings for fast copy past:
# {'lossless': True} {'allow_mixed': True}
quali = {'quality': 90}

Image.open(src_f).save(dst_f, 'webp', **quali, save_all=True)

Shell variant:

gif2webp -v -lossy -q 90 paris_metro.gif -o paris_metro.webp

Example images

Content of the archive:

  • Two input gifs
  • both output files (converted with "quality 90") with problems 1. and 2.
  • paris_metro.webp has also problem 3. present. (pixel errors are to see while playing)
    anim.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions