Opened 3 years ago
Last modified 2 years ago
#10640 new defect
Incorrect interpretation of PNG data in "monob" pixel format
| Reported by: | Joey Sodergren | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | ffmpeg |
| Version: | 6.1 | Keywords: | png |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
Since this summer, I've been doing a lot of experimentation with PNG optimization. As part of my process, I started running files through FFMPEG to re-encode them as a sort of "encoding normalization" step. (Don't ask why this is necessary... I experimentally proved it helped the rest of my system produce better / smaller results.) I have recently discovered a bug in FFMPEG's ability to read some PNG files. While FFMPEG does appear to be aware that images in the pal8 pixel format can contain transparency data, it does not appear to be aware that images in the monob pixel format can also contain transparency data, and is improperly crushing it to opaque pixels.
How to reproduce:
- The files
Palette_Mode.pngandMonob_Mode.pngare encoded with different pixel formats, but they both store their pixels as single bits.- These two files should be attached to this ticket.
- If you download them on Windows, inspect their Properties and open the Details tab. You should see
Bit depth 1.
- The files
Palette_Mode.pngandMonob_Mode.pngshould appear visually identical: fully opaque white glyphs on a fully transparent background.
% ffprobe -hide_banner -v error -show_entries frame=pix_fmt Palette_Mode.png [FRAME] pix_fmt=pal8 [/FRAME] % ffprobe -hide_banner -v error -show_entries frame=pix_fmt Monob_Mode.png [FRAME] pix_fmt=monob [/FRAME] % ffmpeg -hide_banner -v error -i Palette_Mode.png -c png -pix_fmt rgba -update 1 Pal_Expand.png % ffmpeg -hide_banner -v error -i Monob_Mode.png -c png -pix_fmt rgba -update 1 Mono_Expand.png
At this point, inspect the files Pal_Expand.png and Mono_Expand.png. The file Pal_Expand.png should appear visually identical to the input. The file Mono_Expand.png, however, should not. Its transparent background will be improperly crushed to opaque black.
Attachments (2)
Change History (5)
by , 3 years ago
| Attachment: | Palette_Mode.png added |
|---|
by , 3 years ago
| Attachment: | Monob_Mode.png added |
|---|
comment:2 by , 2 years ago
| Version: | 6.0 → 6.1 |
|---|
comment:3 by , 2 years ago
| Keywords: | png added |
|---|



I have upgraded my copy of FFMPEG to 6.1, and I can confirm the issue is still present. (I'm not particularly surprised, though. No one seems to have tested this other than myself.)