Enum image::DynamicImage
[−]
[src]
pub enum DynamicImage { ImageLuma8(GrayImage), ImageLumaA8(GrayAlphaImage), ImageRgb8(RgbImage), ImageRgba8(RgbaImage), }
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
Methods
impl DynamicImage
[src]
pub fn new_luma8(w: u32, h: u32) -> DynamicImage
[src]
Creates a dynamic image backed by a buffer of grey pixels.
pub fn new_luma_a8(w: u32, h: u32) -> DynamicImage
[src]
Creates a dynamic image backed by a buffer of grey pixels with transparency.
pub fn new_rgb8(w: u32, h: u32) -> DynamicImage
[src]
Creates a dynamic image backed by a buffer of RGB pixels.
pub fn new_rgba8(w: u32, h: u32) -> DynamicImage
[src]
Creates a dynamic image backed by a buffer of RGBA pixels.
pub fn to_rgb(&self) -> RgbImage
[src]
Returns a copy of this image as an RGB image.
pub fn to_rgba(&self) -> RgbaImage
[src]
Returns a copy of this image as an RGBA image.
pub fn to_luma(&self) -> GrayImage
[src]
Returns a copy of this image as a Luma image.
pub fn to_luma_alpha(&self) -> GrayAlphaImage
[src]
Returns a copy of this image as a LumaA image.
pub fn crop(&mut self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage
[src]
Return a cut out of this image delimited by the bounding rectangle.
pub fn as_rgb8(&self) -> Option<&RgbImage>
[src]
Return a reference to an 8bit RGB image
pub fn as_mut_rgb8(&mut self) -> Option<&mut RgbImage>
[src]
Return a mutable reference to an 8bit RGB image
pub fn as_rgba8(&self) -> Option<&RgbaImage>
[src]
Return a reference to an 8bit RGBA image
pub fn as_mut_rgba8(&mut self) -> Option<&mut RgbaImage>
[src]
Return a mutable reference to an 8bit RGBA image
pub fn as_luma8(&self) -> Option<&GrayImage>
[src]
Return a reference to an 8bit Grayscale image
pub fn as_mut_luma8(&mut self) -> Option<&mut GrayImage>
[src]
Return a mutable reference to an 8bit Grayscale image
pub fn as_luma_alpha8(&self) -> Option<&GrayAlphaImage>
[src]
Return a reference to an 8bit Grayscale image with an alpha channel
pub fn as_mut_luma_alpha8(&mut self) -> Option<&mut GrayAlphaImage>
[src]
Return a mutable reference to an 8bit Grayscale image with an alpha channel
pub fn raw_pixels(&self) -> Vec<u8>
[src]
Return this image's pixels as a byte vector.
pub fn color(&self) -> ColorType
[src]
Return this image's color type.
pub fn grayscale(&self) -> DynamicImage
[src]
Return a grayscale version of this image.
pub fn invert(&mut self)
[src]
Invert the colors of this image. This method operates inplace.
pub fn resize(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
[src]
&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
.
pub fn resize_exact(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
[src]
&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
pub fn blur(&self, sigma: f32) -> DynamicImage
[src]
Performs a Gaussian blur on this image.
sigma
is a measure of how much to blur by.
pub fn unsharpen(&self, sigma: f32, threshold: i32) -> DynamicImage
[src]
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
pub fn filter3x3(&self, kernel: &[f32]) -> DynamicImage
[src]
Filters this image with the specified 3x3 kernel.
pub fn adjust_contrast(&self, c: f32) -> DynamicImage
[src]
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.
pub fn brighten(&self, value: i32) -> DynamicImage
[src]
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.
pub fn huerotate(&self, value: i32) -> DynamicImage
[src]
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)
pub fn flipv(&self) -> DynamicImage
[src]
Flip this image vertically
pub fn fliph(&self) -> DynamicImage
[src]
Flip this image horizontally
pub fn rotate90(&self) -> DynamicImage
[src]
Rotate this image 90 degrees clockwise.
pub fn rotate180(&self) -> DynamicImage
[src]
Rotate this image 180 degrees clockwise.
pub fn rotate270(&self) -> DynamicImage
[src]
Rotate this image 270 degrees clockwise.
pub fn save<W: Write>(&self, w: &mut W, format: ImageFormat) -> ImageResult<()>
[src]
Encode this image and write it to w
Trait Implementations
impl Clone for DynamicImage
[src]
fn clone(&self) -> DynamicImage
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl GenericImage for DynamicImage
[src]
type Pixel = Rgba<u8>
The type of pixel.
fn dimensions(&self) -> (u32, u32)
[src]
The width and height of this image.
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
The bounding rectangle of this image.
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
[src]
Returns the pixel located at (x, y) Read more
fn put_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
[src]
Put a pixel at location (x, y) Read more
fn blend_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
[src]
DEPRECATED: Use iterator pixels_mut
to blend the pixels directly.
fn get_pixel_mut(&mut self, _: u32, _: u32) -> &mut Rgba<u8>
[src]
DEPRECATED: Do not use is function: It is unimplemented!
fn width(&self) -> u32
[src]
The width of this image.
fn height(&self) -> u32
[src]
The height of this image.
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
Returns true if this x, y coordinate is contained inside the image.
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
Returns the pixel located at (x, y) Read more
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)
[src]
Puts a pixel at location (x, y) Read more
fn pixels(&self) -> Pixels<Self>
[src]
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value Read more
fn pixels_mut(&mut self) -> MutPixels<Self>
[src]
Returns an Iterator over mutable pixels of this image. The iterator yields the coordinates of each pixel along with a mutable reference to them. Read more
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
O: GenericImage<Pixel = Self::Pixel>,
[src]
O: GenericImage<Pixel = Self::Pixel>,
Copies all of the pixels from another image into this image. Read more
fn sub_image(
&mut self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<Self> where
Self: 'static,
<Self::Pixel as Pixel>::Subpixel: 'static,
Self::Pixel: 'static,
[src]
&mut self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<Self> where
Self: 'static,
<Self::Pixel as Pixel>::Subpixel: 'static,
Self::Pixel: 'static,
Returns a subimage that is a view into this image.