pub struct GifEncoder { /* private fields */ }Expand description
Encodes a single-frame GIF.
Implementations§
Source§impl GifEncoder
impl GifEncoder
Sourcepub const fn new() -> GifEncoder
pub const fn new() -> GifEncoder
An encoder with a full 256-colour palette and dithering.
Sourcepub fn with_colours(self, colours: usize) -> Result<GifEncoder, PixelsError>
pub fn with_colours(self, colours: usize) -> Result<GifEncoder, PixelsError>
An encoder aiming for at most colours palette entries.
§Errors
Returns PixelsError::InvalidArgument outside 2..=256.
Sourcepub const fn without_dithering(self) -> GifEncoder
pub const fn without_dithering(self) -> GifEncoder
An encoder with dithering disabled.
Sourcepub fn with_dither(self, dither: f32) -> Result<GifEncoder, PixelsError>
pub fn with_dither(self, dither: f32) -> Result<GifEncoder, PixelsError>
An encoder diffusing dither of the quantization error, 0 (none) to
1 (full Floyd-Steinberg, the default), as sharp’s dither.
§Errors
Returns PixelsError::InvalidArgument outside 0..=1.
Sourcepub fn from_options(options: &EncodeOptions) -> GifEncoder
pub fn from_options(options: &EncodeOptions) -> GifEncoder
An encoder configured from generic encode options.
GIF has no quality dial in the JPEG sense — it is lossless given a
palette, and the palette is where all the loss lives. So quality is
read as palette size, mapping 1..=100 onto 2..=256 entries, which is
the axis that actually trades size for fidelity, unless
EncodeOptions::colours gives the size outright.
EncodeOptions::dither sets the dithering.
Trait Implementations§
Source§impl Debug for GifEncoder
impl Debug for GifEncoder
Source§impl Default for GifEncoder
impl Default for GifEncoder
Source§fn default() -> GifEncoder
fn default() -> GifEncoder
Source§impl Encoder for GifEncoder
impl Encoder for GifEncoder
Source§fn write_header(
&mut self,
desc: &ImageDescriptor,
_sink: &mut dyn Sink,
) -> Result<(), PixelsError>
fn write_header( &mut self, desc: &ImageDescriptor, _sink: &mut dyn Sink, ) -> Result<(), PixelsError>
Source§fn write_row(
&mut self,
row: &[u8],
_sink: &mut dyn Sink,
) -> Result<(), PixelsError>
fn write_row( &mut self, row: &[u8], _sink: &mut dyn Sink, ) -> Result<(), PixelsError>
Source§fn finish(&mut self, sink: &mut dyn Sink) -> Result<(), PixelsError>
fn finish(&mut self, sink: &mut dyn Sink) -> Result<(), PixelsError>
Source§fn set_icc_profile(&mut self, profile: Option<&[u8]>) -> Result<(), PixelsError>
fn set_icc_profile(&mut self, profile: Option<&[u8]>) -> Result<(), PixelsError>
profile as the image’s ICC colour profile, or write none. Read moreSource§fn set_exif(&mut self, exif: Option<&[u8]>) -> Result<(), PixelsError>
fn set_exif(&mut self, exif: Option<&[u8]>) -> Result<(), PixelsError>
exif (TIFF-structured bytes, as Decoder::exif gives
them) as the image’s EXIF block, or write none. Read moreSource§fn set_density(&mut self, density: Option<Density>) -> Result<(), PixelsError>
fn set_density(&mut self, density: Option<Density>) -> Result<(), PixelsError>
density as the image’s resolution, or write the format’s
default. Read more