#11424 closed defect (worksforme)
Colors distorted converting from APNG to GIF
Reported by: | idest | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | unspecified | Keywords: | colorspace |
Cc: | idest, MasterQuestionable | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | yes |
Description (last modified by )
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)
Change History (8)
by , 12 days ago
Attachment: | spiral.png added |
---|
by , 12 days ago
Attachment: | spiral.gif added |
---|
comment:1 by , 12 days ago
Description: | modified (diff) |
---|
comment:3 by , 12 days ago
Thank you for the explanation, Leo, your command produces the desired result.
comment:4 by , 12 days ago
Analyzed by developer: | set |
---|---|
Cc: | added |
Keywords: | colorspace added |
Resolution: | → worksforme |
Status: | new → closed |
Summary: | Colors get distorted when converting from an animated PNG into an animated GIF → Colors distorted converting from APNG to GIF |
͏ Should qualify as part of a future enhancement.
͏ (Improve handling of default colorspace selection)
comment:5 by , 11 days ago
Enchancement like this is quite hard. Would need analysis how many colors are there, what gif encoding to use — image magik does it...
comment:6 by , 11 days ago
͏ Not attempt for Palette optimization (to fit GIF).
͏ Merely the simple logic branching to use more sensible pixel format (colorspace).
͏ Avoid insensible alike: https://trac.ffmpeg.org/ticket/11222
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.