Module exr::image::crop

source ·
Expand description

Crop away unwanted pixels. Includes automatic detection of bounding rectangle. Currently does not support deep data and resolution levels.

Structs

Enums

  • Cropping an image fails if the image is fully transparent. Use [or_crop_to_1x1_if_empty] or [or_none_if_empty] to obtain a normal image again.

Traits

  • Realize a cropped view of the original data, by actually removing the unwanted original pixels, reducing the memory consumption. Currently not supported for SpecificChannels.
  • Crop some pixels ways when specifying a smaller rectangle
  • Crop away unwanted pixels from the border if they match the specified rule.
  • Something that has a two-dimensional rectangular shape
  • Inspect the pixels in this image to determine where to crop some away

Functions

  • Return the smallest bounding rectangle including all pixels that satisfy the predicate. Worst case: Fully transparent image, visits each pixel once. Best case: Fully opaque image, visits two pixels. Returns None if the image is fully transparent. Returns [(0,0), size] if the image is fully opaque. Designed to be cache-friendly linear search. Optimized for row-major image vectors.