[][src]Function photon::transform::crop

pub fn crop(
    photon_image: &mut PhotonImage,
    x1: u32,
    y1: u32,
    x2: u32,
    y2: u32
) -> PhotonImage

Crop an image.

Arguments

Example

// For example, to crop an image at (0, 0) to (500, 800)
use photon::transform;
let img = photon::open_image("img.jpg");
let cropped_img = photon::transform::crop(&mut img, 0, 0, 500, 800);
// Write the contents of this image in JPG format.
photon::helpers::save_image(cropped_img, "cropped_image.png");