Skip to content

Commit

Permalink
Direct user to DynamicImage for converting
Browse files Browse the repository at this point in the history
Attempts to address the documentation suggestion in #1252

A lot of the methods for modifying an image are found in the ImageBuffer
so that is where I was looking when trying to convert an image to a
different Pixel type.
  • Loading branch information
robyoung committed Jun 5, 2020
1 parent 2276d72 commit 1face8f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/buffer.rs
Expand Up @@ -416,6 +416,8 @@ where
/// [`RgbImage`]: type.RgbImage.html
/// [`GrayImage`]: type.GrayImage.html
///
/// To convert between images of different Pixel types use [`DynamicImage`]: enum.DynamicImage.html
///
/// ## Examples
///
/// Create a simple canvas and paint a small cross.
Expand Down Expand Up @@ -449,6 +451,15 @@ where
///
/// image::imageops::overlay(&mut img, &on_top, 128, 128);
/// ```
///
/// Convert an RgbaImage to a GrayImage.
///
/// ```no_run
/// use image::{open, DynamicImage};
///
/// let rgba = open("path/to/some.png").unwrap().into_rgba();
/// let gray = DynamicImage::ImageRgba8(rgba).into_luma();
/// ```
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct ImageBuffer<P: Pixel, Container> {
width: u32,
Expand Down

0 comments on commit 1face8f

Please sign in to comment.