[FFmpeg-devel] Scaling PAL8 images with alpha

Soft Works softworkz at hotmail.com
Fri Sep 24 13:30:31 EEST 2021


Hi,

for a new filter, I want to rescale PAL8 subtitle bitmaps where the palette includes
colors with alpha.

From what I’ve seen, swscale doesn’t support PAL8-to-PAL8, only PAL8-to-BGR8
which doesn’t support alpha and the palette is fixed with 256 entries defined by
convention, while I would ideally like to be able to allow the following:

- constrain the output to use the same palette as the input
- adaptively quantize it to a palette with a configurable number of colors

Thus it's about the palette quantization (with or without dithering) after 
scaling in RGBA. (or some cool algorithmic trick I'm not aware of)

Is there any existing code that I could reuse? The closest I could find
is pngenc, but I'm wondering whether there's something else/better 
somewhere in the ffmpeg libs that I haven't seen?

Thanks,
softworkz





More information about the ffmpeg-devel mailing list