Skip to main content

encode_jpeg

Function encode_jpeg 

Source
pub fn encode_jpeg(
    pixels: &[u8],
    width: u16,
    height: u16,
    samples_per_pixel: u8,
    params: &JpegParams,
) -> DcmResult<Vec<u8>>
Expand description

Encode raw pixel bytes as JPEG baseline/extended-style Huffman JPEG.

  • pixels: interleaved pixel bytes (grayscale = 1 byte/px, RGB = 3 bytes/px)
  • width, height: image dimensions in pixels
  • samples_per_pixel: 1 (grayscale) or 3 (RGB/YCbCr)
  • params: encoding parameters (quality, sampling factor)

Returns the JPEG-compressed fragment bytes.