Trait nannou::image::buffer::ConvertBuffer [−][src]
pub trait ConvertBuffer<T> { pub fn convert(&self) -> T; }
Provides color conversions for whole image buffers.
Required methods
pub fn convert(&self) -> T
[src]
Converts self
to a buffer of type T
A generic implementation is provided to convert any image buffer to a image buffer
based on a Vec<T>
.
Implementors
impl<'a, 'b, Container, FromType, ToType> ConvertBuffer<ImageBuffer<ToType, Vec<<ToType as Pixel>::Subpixel, Global>>> for ImageBuffer<FromType, Container> where
Container: Deref<Target = [<FromType as Pixel>::Subpixel]>,
FromType: 'static + Pixel,
ToType: 'static + Pixel + FromColor<FromType>,
<FromType as Pixel>::Subpixel: 'static,
<ToType as Pixel>::Subpixel: 'static,
[src]
Container: Deref<Target = [<FromType as Pixel>::Subpixel]>,
FromType: 'static + Pixel,
ToType: 'static + Pixel + FromColor<FromType>,
<FromType as Pixel>::Subpixel: 'static,
<ToType as Pixel>::Subpixel: 'static,
pub fn convert(
&self
) -> ImageBuffer<ToType, Vec<<ToType as Pixel>::Subpixel, Global>>
[src]
&self
) -> ImageBuffer<ToType, Vec<<ToType as Pixel>::Subpixel, Global>>
Examples
Convert RGB image to gray image.
use image::buffer::ConvertBuffer; use image::GrayImage; let image_path = "examples/fractal.png"; let image = image::open(&image_path) .expect("Open file failed") .to_rgba(); let gray_image: GrayImage = image.convert();