Module crop
Crop away unwanted pixels. Includes automatic detection of bounding rectangle. Currently does not support deep data and resolution levels.
Structs
- CroppedChannels A smaller window into an existing pixel storage
- CroppedWriter A writer for the cropped view layer
Enums
-
CropResult
Cropping an image fails if the image is fully transparent.
Use
or_crop_to_1x1_if_emptyoror_none_if_emptyto obtain a normal image again.
Traits
-
ApplyCroppedView
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
- CropWhere Crop away unwanted pixels from the border if they match the specified rule.
- GetBounds Something that has a two-dimensional rectangular shape
- InspectSample 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
Noneif 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.