pub extern "C" fn __wasm_bindgen_generated_crop(
    arg0: <PhotonImage as RefMutFromWasmAbi>::Abi,
    arg1: <u32 as FromWasmAbi>::Abi,
    arg2: <u32 as FromWasmAbi>::Abi,
    arg3: <u32 as FromWasmAbi>::Abi,
    arg4: <u32 as FromWasmAbi>::Abi
) -> <PhotonImage as ReturnWasmAbi>::Abi
Expand description

Crop an image.

Arguments

  • img - A PhotonImage.

Example

// For example, to crop an image at (0, 0) to (500, 800)
use photon_rs::native::{open_image};
use photon_rs::transform::crop;
use photon_rs::PhotonImage;

let mut img = open_image("img.jpg").expect("File should open");
let cropped_img: PhotonImage = crop(&mut img, 0_u32, 0_u32, 500_u32, 800_u32);
// Write the contents of this image in JPG format.