Opened 11 hours ago

Last modified 11 hours ago

#11424 new defect

Colors get distorted when converting from an animated PNG into an animated GIF

Reported by: idest Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: idest Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by idest)

Try converting the attached animated PNG file, spiral.png, into a GIF animation with the command

ffmpeg -i spiral.png spiral.gif

Notice that in the resulting file, spiral.gif (also attached), colors are distorted: almost all the curves are in yellow.

Reported FFMpeg version: N-118325-gea381285e7-20250119,
OS: Windows 10 Home.

Attachments (2)

spiral.png (32.4 KB ) - added by idest 11 hours ago.
spiral.gif (111.6 KB ) - added by idest 11 hours ago.

Download all attachments as: .zip

Change History (5)

by idest, 11 hours ago

Attachment: spiral.png added

by idest, 11 hours ago

Attachment: spiral.gif added

comment:1 by idest, 11 hours ago

Description: modified (diff)

comment:2 by Leo Izen, 11 hours ago

This is caused by the automatic converstion from rgb24 to bgr8, which is the default for the gif encoder. bgr8 cannot represent the colors correctly. Use this instead:

ffmpeg -i spiral.png -vf 'split[v],palettegen,[v]paletteuse' spiral.gif

The original picture only has 60 colors so this shouldn't create any loss.

Last edited 11 hours ago by Leo Izen (previous) (diff)

comment:3 by idest, 11 hours ago

Thank you for the explanation, Leo, your command produces the desired result.

Note: See TracTickets for help on using tickets.