Enum image::DynamicImage [−][src]
pub enum DynamicImage { ImageLuma8(GrayImage), ImageLumaA8(GrayAlphaImage), ImageRgb8(RgbImage), ImageRgba8(RgbaImage), ImageBgr8(ImageBuffer<Bgr<u8>, Vec<u8>>), ImageBgra8(ImageBuffer<Bgra<u8>, Vec<u8>>), ImageLuma16(ImageBuffer<Luma<u16>, Vec<u16>>), ImageLumaA16(ImageBuffer<LumaA<u16>, Vec<u16>>), ImageRgb16(ImageBuffer<Rgb<u16>, Vec<u16>>), ImageRgba16(ImageBuffer<Rgba<u16>, Vec<u16>>), }
Expand description
A Dynamic Image
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
ImageBgr8(ImageBuffer<Bgr<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Bgr
ImageBgra8(ImageBuffer<Bgra<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Bgr 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
Implementations
Creates a dynamic image backed by a buffer of grey pixels.
Creates a dynamic image backed by a buffer of grey pixels with transparency.
Creates a dynamic image backed by a buffer of RGB pixels.
Creates a dynamic image backed by a buffer of RGBA pixels.
Creates a dynamic image backed by a buffer of BGRA pixels.
Creates a dynamic image backed by a buffer of BGR pixels.
Creates a dynamic image backed by a buffer of grey pixels.
Creates a dynamic image backed by a buffer of grey pixels with transparency.
Creates a dynamic image backed by a buffer of RGB pixels.
Creates a dynamic image backed by a buffer of RGBA pixels.
Decodes an encoded image into a dynamic image.
👎 Deprecated: replaced by to_rgb8
replaced by to_rgb8
Returns a copy of this image as an RGB image.
Returns a copy of this image as an RGB image.
👎 Deprecated: replaced by to_rgba8
replaced by to_rgba8
Returns a copy of this image as an RGBA image.
Returns a copy of this image as an RGBA image.
👎 Deprecated: replaced by to_bgr8
replaced by to_bgr8
Returns a copy of this image as an BGR image.
Returns a copy of this image as an BGR image.
👎 Deprecated: replaced by to_bgra8
replaced by to_bgra8
Returns a copy of this image as an BGRA image.
Returns a copy of this image as an BGRA image.
👎 Deprecated: replaced by to_luma8
replaced by to_luma8
Returns a copy of this image as a Luma image.
Returns a copy of this image as a Luma image.
👎 Deprecated: replaced by to_luma_alpha8
replaced by to_luma_alpha8
Returns a copy of this image as a LumaA image.
Returns a copy of this image as a LumaA image.
Returns a copy of this image as a LumaA image.
👎 Deprecated: replaced by into_rgb8
replaced by into_rgb8
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.
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.
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.
👎 Deprecated: replaced by into_rgba8
replaced by into_rgba8
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.
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.
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.
👎 Deprecated: replaced by into_bgra8
replaced by into_bgra8
Consume the image and returns a BGR image.
If the image was already the correct format, it is returned as is. Otherwise, a copy is created.
Consume the image and returns a BGR image.
If the image was already the correct format, it is returned as is. Otherwise, a copy is created.
👎 Deprecated: replaced by into_bgra8
replaced by into_bgra8
Consume the image and returns a BGRA image.
If the image was already the correct format, it is returned as is. Otherwise, a copy is created.
Consume the image and returns a BGRA image.
If the image was already the correct format, it is returned as is. Otherwise, a copy is created.
👎 Deprecated: replaced by into_luma8
replaced by into_luma8
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.
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.
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.
👎 Deprecated: replaced by into_luma_alpha8
replaced by into_luma_alpha8
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.
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.
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.
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
Return a cut-out of this image delimited by the bounding rectangle.
Return a mutable reference to an 8bit RGB image
Return a reference to an 8bit BGR image
Return a mutable reference to an 8bit BGR image
Return a mutable reference to an 8bit RGBA image
Return a reference to an 8bit BGRA image
Return a mutable reference to an 8bit RGBA image
Return a mutable reference to an 8bit Grayscale image
Return a reference to an 8bit Grayscale image with an alpha channel
Return a mutable reference to an 8bit Grayscale image with an alpha channel
Return a reference to an 16bit RGB image
Return a mutable reference to an 16bit RGB image
Return a reference to an 16bit RGBA image
Return a mutable reference to an 16bit RGBA image
Return a reference to an 16bit Grayscale image
Return a mutable reference to an 16bit Grayscale image
Return a reference to an 16bit Grayscale image with an alpha channel
Return a mutable reference to an 16bit Grayscale image with an alpha channel
Return a view on the raw sample buffer for 8 bit per channel images.
Return a view on the raw sample buffer for 16 bit per channel images.
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.
Return a grayscale version of this image.
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
.
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
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.
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.
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.
Performs a Gaussian blur on this image.
sigma
is a measure of how much to blur by.
Performs an unsharpen mask on this image.
sigma
is the amount to blur the image by.
threshold
is a control of how much to sharpen.
See https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking
Filters this image with the specified 3x3 kernel.
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.
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.
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)
Flip this image vertically
Flip this image horizontally
Rotate this image 90 degrees clockwise.
Rotate this image 180 degrees clockwise.
Rotate this image 270 degrees clockwise.
pub fn write_to<W: Write, F: Into<ImageOutputFormat>>(
&self,
w: &mut W,
format: F
) -> ImageResult<()>
pub fn write_to<W: Write, F: Into<ImageOutputFormat>>(
&self,
w: &mut W,
format: F
) -> ImageResult<()>
Encode this image and write it to w
Saves the buffer to a file at the path specified.
The image format is derived from the file extension.
pub fn save_with_format<Q>(
&self,
path: Q,
format: ImageFormat
) -> ImageResult<()> where
Q: AsRef<Path>,
pub fn save_with_format<Q>(
&self,
path: Q,
format: ImageFormat
) -> ImageResult<()> where
Q: AsRef<Path>,
Saves the buffer to a file at the specified path in the specified format.
See save_buffer_with_format
for
supported types.
Trait Implementations
DEPRECATED: Use iterator pixels_mut
to blend the pixels directly.
DEPRECATED: Do not use is function: It is unimplemented!
type InnerImage = DynamicImage
type InnerImage = DynamicImage
Underlying image type. This is mainly used by SubImages in order to always have a reference to the original image. This allows for less indirections and it eases the use of nested SubImages. Read more
Put a pixel at location (x, y). Indexed from top left. Read more
Returns a mutable reference to the underlying image.
Puts a pixel at location (x, y). Indexed from top left. Read more
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> ImageResult<()> where
O: GenericImageView<Pixel = Self::Pixel>,
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> ImageResult<()> where
O: GenericImageView<Pixel = Self::Pixel>,
Copies all of the pixels from another image into this image. Read more
Copies all of the pixels from one part of this image to another part of this image. Read more
Returns a mutable subimage that is a view into this image.
If you want an immutable subimage instead, use GenericImageView::view
The coordinates set the position of the top left corner of the SubImage. Read more
type InnerImageView = Self
type InnerImageView = Self
Underlying image type. This is mainly used by SubImages in order to always have a reference to the original image. This allows for less indirections and it eases the use of nested SubImages. Read more
Returns the pixel located at (x, y). Indexed from top left. Read more
Returns a reference to the underlying image.
Returns true if this x, y coordinate is contained inside the image.
Returns the pixel located at (x, y). Indexed from top left. Read more
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value Read more
Returns an subimage that is an immutable view into this image.
You can use GenericImage::sub_image
if you need a mutable view instead.
The coordinates set the position of the top left corner of the view. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for DynamicImage
impl Send for DynamicImage
impl Sync for DynamicImage
impl Unpin for DynamicImage
impl UnwindSafe for DynamicImage
Blanket Implementations
Mutably borrows from an owned value. Read more