Encode

Trait Encode 

Source
pub trait Encode {
    // Required methods
    fn encode_rgb(
        &self,
        rgb_data: &[u8],
        width: u32,
        height: u32,
    ) -> Result<Vec<u8>, Error>;
    fn encode_gray(
        &self,
        gray_data: &[u8],
        width: u32,
        height: u32,
    ) -> Result<Vec<u8>, Error>;
}
Expand description

Trait for JPEG encoding (batch mode).

Implemented by both Encoder and StreamingEncoder.

Required Methods§

Source

fn encode_rgb( &self, rgb_data: &[u8], width: u32, height: u32, ) -> Result<Vec<u8>, Error>

Encode RGB image data to JPEG.

§Arguments
  • rgb_data - RGB pixel data (3 bytes per pixel, row-major order)
  • width - Image width in pixels
  • height - Image height in pixels
Source

fn encode_gray( &self, gray_data: &[u8], width: u32, height: u32, ) -> Result<Vec<u8>, Error>

Encode grayscale image data to JPEG.

§Arguments
  • gray_data - Grayscale pixel data (1 byte per pixel, row-major order)
  • width - Image width in pixels
  • height - Image height in pixels

Implementors§

Source§

impl Encode for Encoder

Source§

impl Encode for StreamingEncoder

Implement batch encoding for StreamingEncoder (without optimizations).