Enum DynamicImage

#[non_exhaustive]
pub enum DynamicImage

A Dynamic Image

This represents a matrix of pixels which are convertible from and to an RGBA representation. More variants that adhere to these principles may get added in the future, in particular to cover other combinations typically used.

Usage

This type can act as a converter between specific ImageBuffer instances.

use image::{DynamicImage, GrayImage, RgbImage};

let rgb: RgbImage = RgbImage::new(10, 10);
let luma: GrayImage = DynamicImage::ImageRgb8(rgb).into_luma8();

Design

There is no goal to provide an all-encompassing type with all possible memory layouts. This would hardly be feasible as a simple enum, due to the sheer number of combinations of channel kinds, channel order, and bit depth. Rather, this type provides an opinionated selection with normalized channel order which can store common pixel values without loss.

Color space

Each image has an associated color space in the form of CICP data (ITU Rec H.273). Not all color spaces are supported in the sense that you can compute in them (Context). Conversion into different pixels types ([ColorType]crate::ColorType) generally take the color space into account, with the exception of DynamicImage::to due to historical design baggage.

The imageops functions operate in encoded space, directly on the channel values, and do not linearize colors internally as you might be used to from GPU shader programming. Their return values however copy the color space annotation of the source.

The IO functions do not yet write ICC or CICP indications into the result formats. We're aware of this problem, it is tracked in #2493 and #1460.

Variants

ImageLuma8(GrayImage)

Each pixel in this image is 8-bit Luma

ImageLumaA8(GrayAlphaImage)

Each pixel in this image is 8-bit Luma with alpha

ImageRgb8(RgbImage)

Each pixel in this image is 8-bit Rgb

ImageRgba8(RgbaImage)

Each pixel in this image is 8-bit Rgb with alpha

ImageLuma16(ImageBuffer<Luma<u16>, Vec<u16>>)

Each pixel in this image is 16-bit Luma

ImageLumaA16(ImageBuffer<LumaA<u16>, Vec<u16>>)

Each pixel in this image is 16-bit Luma with alpha

ImageRgb16(ImageBuffer<Rgb<u16>, Vec<u16>>)

Each pixel in this image is 16-bit Rgb

ImageRgba16(ImageBuffer<Rgba<u16>, Vec<u16>>)

Each pixel in this image is 16-bit Rgb with alpha

ImageRgb32F(Rgb32FImage)

Each pixel in this image is 32-bit float Rgb

ImageRgba32F(Rgba32FImage)

Each pixel in this image is 32-bit float Rgb with alpha

Implementations

impl DynamicImage

fn new(w: u32, h: u32, color: ColorType) -> DynamicImage

Creates a dynamic image backed by a buffer depending on the color type given.

The color space is initially set to [sRGB]Cicp::SRGB.

fn new_luma8(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of gray pixels.

fn new_luma_a8(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of gray pixels with transparency.

fn new_rgb8(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGB pixels.

fn new_rgba8(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGBA pixels.

fn new_luma16(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of gray pixels.

fn new_luma_a16(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of gray pixels with transparency.

fn new_rgb16(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGB pixels.

fn new_rgba16(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGBA pixels.

fn new_rgb32f(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGB pixels.

fn new_rgba32f(w: u32, h: u32) -> DynamicImage

Creates a dynamic image backed by a buffer of RGBA pixels.

fn from_decoder(decoder: impl ImageDecoder) -> ImageResult<Self>

Decodes an encoded image into a dynamic image.

fn to<T: Pixel + FromColor<Rgb<u8>> + FromColor<Rgb<f32>> + FromColor<Rgba<u8>> + FromColor<Rgba<u16>> + FromColor<Rgba<f32>> + FromColor<Rgb<u16>> + FromColor<Luma<u8>> + FromColor<Luma<u16>> + FromColor<LumaA<u16>> + FromColor<LumaA<u8>>>(&self) -> ImageBuffer<T, Vec<T::Subpixel>>

Encodes a dynamic image into a buffer.

WARNING: Conversion between RGB and Luma is not aware of the color space and always uses sRGB coefficients to determine a non-constant luminance from an RGB color (and conversely).

This unfortunately owes to the public bounds of T which does not allow for passing a color space as a parameter. This function will likely be deprecated and replaced.

fn to_rgb8(&self) -> RgbImage

Returns a copy of this image as an RGB image.

fn to_rgb16(&self) -> ImageBuffer<Rgb<u16>, Vec<u16>>

Returns a copy of this image as an RGB image.

fn to_rgb32f(&self) -> Rgb32FImage

Returns a copy of this image as an RGB image.

fn to_rgba8(&self) -> RgbaImage

Returns a copy of this image as an RGBA image.

fn to_rgba16(&self) -> ImageBuffer<Rgba<u16>, Vec<u16>>

Returns a copy of this image as an RGBA image.

fn to_rgba32f(&self) -> Rgba32FImage

Returns a copy of this image as an RGBA image.

fn to_luma8(&self) -> GrayImage

Returns a copy of this image as a Luma image.

fn to_luma16(&self) -> ImageBuffer<Luma<u16>, Vec<u16>>

Returns a copy of this image as a Luma image.

fn to_luma32f(&self) -> ImageBuffer<Luma<f32>, Vec<f32>>

Returns a copy of this image as a Luma image.

fn to_luma_alpha8(&self) -> GrayAlphaImage

Returns a copy of this image as a LumaA image.

fn to_luma_alpha16(&self) -> ImageBuffer<LumaA<u16>, Vec<u16>>

Returns a copy of this image as a LumaA image.

fn to_luma_alpha32f(&self) -> ImageBuffer<LumaA<f32>, Vec<f32>>

Returns a copy of this image as a LumaA image.

fn into_rgb8(self) -> RgbImage

Consume the image and returns a RGB image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_rgb16(self) -> ImageBuffer<Rgb<u16>, Vec<u16>>

Consume the image and returns a RGB image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_rgb32f(self) -> Rgb32FImage

Consume the image and returns a RGB image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_rgba8(self) -> RgbaImage

Consume the image and returns a RGBA image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_rgba16(self) -> ImageBuffer<Rgba<u16>, Vec<u16>>

Consume the image and returns a RGBA image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_rgba32f(self) -> Rgba32FImage

Consume the image and returns a RGBA image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_luma8(self) -> GrayImage

Consume the image and returns a Luma image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_luma16(self) -> ImageBuffer<Luma<u16>, Vec<u16>>

Consume the image and returns a Luma image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_luma_alpha8(self) -> GrayAlphaImage

Consume the image and returns a LumaA image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn into_luma_alpha16(self) -> ImageBuffer<LumaA<u16>, Vec<u16>>

Consume the image and returns a LumaA image.

If the image was already the correct format, it is returned as is. Otherwise, a copy is created.

fn crop(&mut self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage

Return a cut-out of this image delimited by the bounding rectangle.

Note: this method does not modify the object, and its signature will be replaced with crop_imm()'s in the 0.24 release

fn crop_imm(&self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage

Return a cut-out of this image delimited by the bounding rectangle.

fn as_rgb8(&self) -> Option<&RgbImage>

Return a reference to an 8bit RGB image

fn as_mut_rgb8(&mut self) -> Option<&mut RgbImage>

Return a mutable reference to an 8bit RGB image

fn as_rgba8(&self) -> Option<&RgbaImage>

Return a reference to an 8bit RGBA image

fn as_mut_rgba8(&mut self) -> Option<&mut RgbaImage>

Return a mutable reference to an 8bit RGBA image

fn as_luma8(&self) -> Option<&GrayImage>

Return a reference to an 8bit Grayscale image

fn as_mut_luma8(&mut self) -> Option<&mut GrayImage>

Return a mutable reference to an 8bit Grayscale image

fn as_luma_alpha8(&self) -> Option<&GrayAlphaImage>

Return a reference to an 8bit Grayscale image with an alpha channel

fn as_mut_luma_alpha8(&mut self) -> Option<&mut GrayAlphaImage>

Return a mutable reference to an 8bit Grayscale image with an alpha channel

fn as_rgb16(&self) -> Option<&ImageBuffer<Rgb<u16>, Vec<u16>>>

Return a reference to an 16bit RGB image

fn as_mut_rgb16(&mut self) -> Option<&mut ImageBuffer<Rgb<u16>, Vec<u16>>>

Return a mutable reference to an 16bit RGB image

fn as_rgba16(&self) -> Option<&ImageBuffer<Rgba<u16>, Vec<u16>>>

Return a reference to an 16bit RGBA image

fn as_mut_rgba16(&mut self) -> Option<&mut ImageBuffer<Rgba<u16>, Vec<u16>>>

Return a mutable reference to an 16bit RGBA image

fn as_rgb32f(&self) -> Option<&Rgb32FImage>

Return a reference to an 32bit RGB image

fn as_mut_rgb32f(&mut self) -> Option<&mut Rgb32FImage>

Return a mutable reference to an 32bit RGB image

fn as_rgba32f(&self) -> Option<&Rgba32FImage>

Return a reference to an 32bit RGBA image

fn as_mut_rgba32f(&mut self) -> Option<&mut Rgba32FImage>

Return a mutable reference to an 32bit RGBA image

fn as_luma16(&self) -> Option<&ImageBuffer<Luma<u16>, Vec<u16>>>

Return a reference to an 16bit Grayscale image

fn as_mut_luma16(&mut self) -> Option<&mut ImageBuffer<Luma<u16>, Vec<u16>>>

Return a mutable reference to an 16bit Grayscale image

fn as_luma_alpha16(&self) -> Option<&ImageBuffer<LumaA<u16>, Vec<u16>>>

Return a reference to an 16bit Grayscale image with an alpha channel

fn as_mut_luma_alpha16(&mut self) -> Option<&mut ImageBuffer<LumaA<u16>, Vec<u16>>>

Return a mutable reference to an 16bit Grayscale image with an alpha channel

fn as_flat_samples_u8(&self) -> Option<FlatSamples<&[u8]>>

Return a view on the raw sample buffer for 8 bit per channel images.

fn as_flat_samples_u16(&self) -> Option<FlatSamples<&[u16]>>

Return a view on the raw sample buffer for 16 bit per channel images.

fn as_flat_samples_f32(&self) -> Option<FlatSamples<&[f32]>>

Return a view on the raw sample buffer for 32bit per channel images.

fn as_bytes(&self) -> &[u8]

Return this image's pixels as a native endian byte slice.

fn into_bytes(self) -> Vec<u8>

Return this image's pixels as a byte vector. If the ImageBuffer container is Vec<u8>, this operation is free. Otherwise, a copy is returned.

fn color(&self) -> ColorType

Return this image's color type.

fn width(&self) -> u32

Returns the width of the underlying image

fn height(&self) -> u32

Returns the height of the underlying image

fn set_rgb_primaries(&mut self, color: CicpColorPrimaries)

Define the color space for the image.

The color data is unchanged. Reinterprets the existing red, blue, green channels as points in the new set of primary colors, changing the apparent shade of pixels.

Note that the primaries also define a reference whitepoint When this buffer contains Luma data, the luminance channel is interpreted as the Y channel of a related YCbCr color space as if by a non-constant chromaticity derived matrix. That is, coefficients are not applied in the linear RGB space but use encoded channel values. (In a color space with the linear transfer function there is no difference).

fn set_transfer_function(&mut self, tf: CicpTransferCharacteristics)

Define the transfer function for the image.

The color data is unchanged. Reinterprets all (non-alpha) components in the image, potentially changing the apparent shade of pixels. Individual components are always interpreted as encoded numbers. To denote numbers in a linear RGB space, use CicpTransferCharacteristics::Linear.

fn color_space(&self) -> Cicp

Get the Cicp encoding of this buffer's color data.

fn set_color_space(&mut self, cicp: Cicp) -> ImageResult<()>

Set primaries and transfer characteristics from a Cicp color space.

Returns an error if cicp uses features that are not support with an RGB color space, e.g. a matrix or narrow range (studio encoding) channels.

fn has_alpha(&self) -> bool

Whether the image contains an alpha channel

This is a convenience wrapper around self.color().has_alpha(). For inspecting other properties of the color type you should call [DynamicImage::color] and use the methods on the returned ColorType.

This only checks that the image's pixel type can express transparency, not whether the image actually has any transparent areas.

fn grayscale(&self) -> DynamicImage

Return a grayscale version of this image. Returns Luma images in most cases. However, for f32 images, this will return a grayscale Rgb/Rgba image instead.

fn invert(&mut self)

Invert the colors of this image. This method operates inplace.

This method operates on pixel channel values directly without taking into account color space data.

fn resize(&self, nwidth: u32, nheight: u32, filter: FilterType) -> DynamicImage

Resize this image using the specified filter algorithm. Returns a new image. The image's aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the bounds specified by nwidth and nheight.

This method operates on pixel channel values directly without taking into account color space data.

fn resize_exact(&self, nwidth: u32, nheight: u32, filter: FilterType) -> DynamicImage

Resize this image using the specified filter algorithm. Returns a new image. Does not preserve aspect ratio. nwidth and nheight are the new image's dimensions

This method operates on pixel channel values directly without taking into account color space data.

fn thumbnail(&self, nwidth: u32, nheight: u32) -> DynamicImage

Scale this image down to fit within a specific size. Returns a new image. The image's aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the bounds specified by nwidth and nheight.

This method uses a fast integer algorithm where each source pixel contributes to exactly one target pixel. May give aliasing artifacts if new size is close to old size.

This method operates on pixel channel values directly without taking into account color space data.

fn thumbnail_exact(&self, nwidth: u32, nheight: u32) -> DynamicImage

Scale this image down to a specific size. Returns a new image. Does not preserve aspect ratio. nwidth and nheight are the new image's dimensions. This method uses a fast integer algorithm where each source pixel contributes to exactly one target pixel. May give aliasing artifacts if new size is close to old size.

This method operates on pixel channel values directly without taking into account color space data.

fn resize_to_fill(&self, nwidth: u32, nheight: u32, filter: FilterType) -> DynamicImage

Resize this image using the specified filter algorithm. Returns a new image. The image's aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the larger (relative to aspect ratio) of the bounds specified by nwidth and nheight, then cropped to fit within the other bound.

This method operates on pixel channel values directly without taking into account color space data.

fn blur(&self, sigma: f32) -> DynamicImage

Performs a Gaussian blur on this image.

Arguments

  • sigma - gaussian bell flattening level.

Use [DynamicImage::fast_blur()] for a faster but less accurate version.

This method assumes alpha pre-multiplication for images that contain non-constant alpha. This method typically assumes that the input is scene-linear light. If it is not, color distortion may occur.

This method operates on pixel channel values directly without taking into account color space data.

fn blur_advanced(&self, parameters: GaussianBlurParameters) -> DynamicImage

Performs a Gaussian blur on this image.

Arguments

  • parameters - see [GaussianBlurParameters] for more info

This method assumes alpha pre-multiplication for images that contain non-constant alpha. This method typically assumes that the input is scene-linear light. If it is not, color distortion may occur.

This method operates on pixel channel values directly without taking into account color space data.

fn fast_blur(&self, sigma: f32) -> DynamicImage

Performs a fast blur on this image.

Arguments

  • sigma - value controls image flattening level.

This method typically assumes that the input is scene-linear light. If it is not, color distortion may occur.

This method operates on pixel channel values directly without taking into account color space data.

fn unsharpen(&self, sigma: f32, threshold: i32) -> DynamicImage

Performs an unsharpen mask on this image.

Arguments

  • sigma - value controls image flattening level.
  • threshold - is a control of how much to sharpen.

This method typically assumes that the input is scene-linear light. If it is not, color distortion may occur. It operates on pixel channel values directly without taking into account color space data.

See Digital unsharp masking for more information

fn filter3x3(&self, kernel: &[f32]) -> DynamicImage

Filters this image with the specified 3x3 kernel.

Arguments

  • kernel - slice contains filter. Only slice len is 9 length is accepted.

This method typically assumes that the input is scene-linear light. It operates on pixel channel values directly without taking into account color space data. If it is not, color distortion may occur.

fn adjust_contrast(&self, c: f32) -> DynamicImage

Adjust the contrast of this image. contrast is the amount to adjust the contrast by. Negative values decrease the contrast and positive values increase the contrast.

This method operates on pixel channel values directly without taking into account color space data.

fn brighten(&self, value: i32) -> DynamicImage

Brighten the pixels of this image. value is the amount to brighten each pixel by. Negative values decrease the brightness and positive values increase it.

This method operates on pixel channel values directly without taking into account color space data.

fn huerotate(&self, value: i32) -> DynamicImage

Hue rotate the supplied image. value is the degrees to rotate each pixel by. 0 and 360 do nothing, the rest rotates by the given degree value. just like the css webkit filter hue-rotate(180)

This method operates on pixel channel values directly without taking into account color space data. The HSV color space is dependent on the current color space primaries.

fn flipv(&self) -> DynamicImage

Flip this image vertically

Use apply_orientation if you want to flip the image in-place instead.

fn fliph(&self) -> DynamicImage

Flip this image horizontally

Use apply_orientation if you want to flip the image in-place.

fn rotate90(&self) -> DynamicImage

Rotate this image 90 degrees clockwise.

fn rotate180(&self) -> DynamicImage

Rotate this image 180 degrees.

Use apply_orientation if you want to rotate the image in-place.

fn rotate270(&self) -> DynamicImage

Rotate this image 270 degrees clockwise.

fn apply_orientation(&mut self, orientation: Orientation)

Rotates and/or flips the image as indicated by [Orientation].

This can be used to apply Exif orientation to an image, e.g. to correctly display a photo taken by a smartphone camera:

# fn only_check_if_this_compiles() -> Result<(), Box<dyn std::error::Error>> {
use image::{DynamicImage, ImageReader, ImageDecoder};

let mut decoder = ImageReader::open("file.jpg")?.into_decoder()?;
let orientation = decoder.orientation()?;
let mut image = DynamicImage::from_decoder(decoder)?;
image.apply_orientation(orientation);
# Ok(())
# }

Note that for some orientations cannot be efficiently applied in-place. In that case this function will make a copy of the image internally.

If this matters to you, please see the documentation on the variants of [Orientation] to learn which orientations can and cannot be applied without copying.

fn copy_from_color_space(&mut self, other: &DynamicImage, options: ConvertColorOptions) -> ImageResult<()>

Copy pixel data from one buffer to another.

On success, this dynamic image contains color data equivalent to the sources color data. Neither the color space nor the sample type of self is changed, the data representation is transformed and copied into the current buffer.

Returns Ok if:

See also Self::apply_color_space and Self::convert_color_space to modify an image directly.

Accuracy

All color values are subject to change to their intended values. Please do not rely on them further than your own colorimetric understanding shows them correct. For instance, conversion of RGB to their corresponding Luma values needs to be modified in future versions of this library. Expect colors to be too bright or too dark until further notice.

fn apply_color_space(&mut self, cicp: Cicp, options: ConvertColorOptions) -> ImageResult<()>

Change the color space, modifying pixel values to refer to the same colors.

On success, this dynamic image contains color data equivalent to its previous color data. The sample type of self is not changed, the data representation is transformed within the current buffer.

Returns Ok if:

  • The primaries and transfer functions of both image's color spaces must be supported, otherwise returns a ImageError::Unsupported.
  • The target Cicp must have full range and an Identity matrix. (This library's [Luma]crate::Luma refers implicity to a chromaticity derived non-constant luminance color).

See also Self::copy_from_color_space.

fn convert_color_space(&mut self, cicp: Cicp, options: ConvertColorOptions, color: ColorType) -> ImageResult<()>

Change the color space and pixel type of this image.

On success, this dynamic image contains color data equivalent to its previous color data with another type of pixels.

Returns Ok if:

  • The primaries and transfer functions of both image's color spaces must be supported, otherwise returns a ImageError::Unsupported.
  • The target Cicp must have full range and an Identity matrix. (This library's [Luma]crate::Luma refers implicity to a chromaticity derived non-constant luminance color).

See also Self::copy_from_color_space.

fn write_to<W: Write + Seek>(&self, w: W, format: ImageFormat) -> ImageResult<()>

Encode this image and write it to w.

Assumes the writer is buffered. In most cases, you should wrap your writer in a BufWriter for best performance.

Color Conversion

Unlike other encoding methods in this crate, methods on DynamicImage try to automatically convert the image to some color type supported by the encoder. This may result in a loss of precision or the removal of the alpha channel.

fn write_with_encoder(&self, encoder: impl ImageEncoder) -> ImageResult<()>

Encode this image with the provided encoder.

Color Conversion

Unlike other encoding methods in this crate, methods on DynamicImage try to automatically convert the image to some color type supported by the encoder. This may result in a loss of precision or the removal of the alpha channel.

fn save<Q>(&self, path: Q) -> ImageResult<()>
where
    Q: AsRef<Path>,

Saves the buffer to a file with the format derived from the file extension.

Color Conversion

Unlike other encoding methods in this crate, methods on DynamicImage try to automatically convert the image to some color type supported by the encoder. This may result in a loss of precision or the removal of the alpha channel.

fn save_with_format<Q>(&self, path: Q, format: ImageFormat) -> ImageResult<()>
where
    Q: AsRef<Path>,

Saves the buffer to a file with the specified format.

Color Conversion

Unlike other encoding methods in this crate, methods on DynamicImage try to automatically convert the image to some color type supported by the encoder. This may result in a loss of precision or the removal of the alpha channel.

Trait Implementations

impl Clone for DynamicImage

fn clone(&self) -> Self
fn clone_from(&mut self, source: &Self)

impl Debug for DynamicImage

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for DynamicImage

fn default() -> Self

impl From<ImageBuffer<Luma<f32>, Vec<f32>>> for DynamicImage

fn from(image: ImageBuffer<Luma<f32>, Vec<f32>>) -> Self

impl From<ImageBuffer<Luma<u16>, Vec<u16>>> for DynamicImage

fn from(image: ImageBuffer<Luma<u16>, Vec<u16>>) -> Self

impl From<ImageBuffer<Luma<u8>, Vec<u8>>> for DynamicImage

fn from(image: GrayImage) -> Self

impl From<ImageBuffer<LumaA<f32>, Vec<f32>>> for DynamicImage

fn from(image: ImageBuffer<LumaA<f32>, Vec<f32>>) -> Self

impl From<ImageBuffer<LumaA<u16>, Vec<u16>>> for DynamicImage

fn from(image: ImageBuffer<LumaA<u16>, Vec<u16>>) -> Self

impl From<ImageBuffer<LumaA<u8>, Vec<u8>>> for DynamicImage

fn from(image: GrayAlphaImage) -> Self

impl From<ImageBuffer<Rgb<f32>, Vec<f32>>> for DynamicImage

fn from(image: Rgb32FImage) -> Self

impl From<ImageBuffer<Rgb<u16>, Vec<u16>>> for DynamicImage

fn from(image: ImageBuffer<Rgb<u16>, Vec<u16>>) -> Self

impl From<ImageBuffer<Rgb<u8>, Vec<u8>>> for DynamicImage

fn from(image: RgbImage) -> Self

impl From<ImageBuffer<Rgba<f32>, Vec<f32>>> for DynamicImage

fn from(image: Rgba32FImage) -> Self

impl From<ImageBuffer<Rgba<u16>, Vec<u16>>> for DynamicImage

fn from(image: ImageBuffer<Rgba<u16>, Vec<u16>>) -> Self

impl From<ImageBuffer<Rgba<u8>, Vec<u8>>> for DynamicImage

fn from(image: RgbaImage) -> Self

impl GenericImage for DynamicImage

fn put_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
fn blend_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
fn get_pixel_mut(&mut self, u32, u32) -> &mut Rgba<u8>

Do not use is function: It is unimplemented!

impl GenericImageView for DynamicImage

type Pixel = Rgba<u8>;
fn dimensions(&self) -> (u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>

impl PartialEq for DynamicImage

fn eq(&self, other: &DynamicImage) -> bool

impl StructuralPartialEq for DynamicImage

Auto Trait Implementations

impl Freeze for DynamicImage

impl RefUnwindSafe for DynamicImage

impl Send for DynamicImage

impl Sync for DynamicImage

impl Unpin for DynamicImage

impl UnsafeUnpin for DynamicImage

impl UnwindSafe for DynamicImage

Blanket Implementations

impl<R, P> ReadPrimitive<R> for DynamicImage where R: Read + ReadEndian<P>, P: Default,

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DynamicImage where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DynamicImage where ST: ?Sized, DT: ?Sized,

impl<T> Any for DynamicImage where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for DynamicImage where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for DynamicImage where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for DynamicImage where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for DynamicImage

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for DynamicImage

impl<T> Pointable for DynamicImage

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> Read<Exclusive, BecauseExclusive> for DynamicImage where T: ?Sized,

impl<T> ToOwned for DynamicImage where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for DynamicImage where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for DynamicImage where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for DynamicImage where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>