[][src]Trait ndarray_vision::format::Encoder

pub trait Encoder<T, C> where
    T: Copy + Clone + Num + NumAssignOps + NumCast + PartialOrd + Display + PixelBound,
    C: ColourModel
{ fn encode(&self, image: &Image<T, C>) -> Vec<u8>; fn encode_file<P: AsRef<Path>>(
        &self,
        image: &Image<T, C>,
        filename: P
    ) -> Result<()> { ... } }

Trait for an image encoder

Required methods

fn encode(&self, image: &Image<T, C>) -> Vec<u8>

Encode an image into a sequence of bytes for the given format

Loading content...

Provided methods

fn encode_file<P: AsRef<Path>>(
    &self,
    image: &Image<T, C>,
    filename: P
) -> Result<()>

Encode an image saving it to the file at filename. This function shouldn't add an extension preferring the user to do that instead.

Loading content...

Implementors

impl<T> Encoder<T, RGB> for PpmEncoder where
    T: Copy + Clone + Num + NumAssignOps + NumCast + PartialOrd + Display + PixelBound + FromPrimitive
[src]

Implements the encoder trait for the PpmEncoder.

The ColourModel type argument is locked to RGB - this prevents calling RGB::into::() unnecessarily which is unavoidable until trait specialisation is stabilised.

fn encode_file<P: AsRef<Path>>(
    &self,
    image: &Image<T, C>,
    filename: P
) -> Result<()>
[src]

Loading content...