Skip to content

Add option to control pallete size #192

@nathaniel-daniel

Description

@nathaniel-daniel

While creating a frame in the process of encoding, this library is able to quantize the colors in an rgba buffer to a pallete of 256 colors. I'm interested in reducing this pallete size to reduce the size of the produced gif.
In short, I would like to extend this method on Frame:

pub fn from_rgba_speed
    width: u16
    height: u16
    pixels: &mut [u8],
    speed: i32,
) -> Frame<'static>

to something like this:

pub fn from_rgba_speed
    width: u16
    height: u16
    pixels: &mut [u8],
    speed: i32,
    pallete_size: u8
) -> Frame<'static>

Alternatively, I could implement the relevant functionality myself and pass the indexed pixels and pallete to the appropriate constructor, but I think it would be nice to expose an option to tune the pallete size since the library already seems to do the work for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions