Expand description
Crop away unwanted pixels. Includes automatic detection of bounding rectangle. Currently does not support deep data and resolution levels.
Structs§
- Cropped
Channels - A smaller window into an existing pixel storage
- Cropped
Writer - A writer for the cropped view layer
Enums§
- Crop
Result - 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§
- Apply
Cropped View - 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
- Crop some pixels ways when specifying a smaller rectangle
- Crop
Where - Crop away unwanted pixels from the border if they match the specified rule.
- GetBounds
- Something that has a two-dimensional rectangular shape
- Inspect
Sample - Inspect the pixels in this image to determine where to crop some away
Functions§
- try_
find_ smaller_ bounds - 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.