pub enum ImageData {
Rgb8(ImgVec<RGB8>),
Rgba8(ImgVec<RGBA8>),
RgbSlice {
data: Vec<u8>,
width: usize,
height: usize,
},
RgbaSlice {
data: Vec<u8>,
width: usize,
height: usize,
},
RgbSliceWithIcc {
data: Vec<u8>,
width: usize,
height: usize,
icc_profile: Vec<u8>,
},
}Expand description
Image data accepted by the evaluation session.
Supports both imgref::ImgVec types and raw slices for flexibility.
For decoded images with ICC profiles, use the WithIcc variants.
Variants§
Rgb8(ImgVec<RGB8>)
RGB8 image using imgref.
Rgba8(ImgVec<RGBA8>)
RGBA8 image using imgref.
RgbSlice
RGB8 raw slice with dimensions.
Fields
RgbaSlice
RGBA8 raw slice with dimensions.
Fields
RgbSliceWithIcc
RGB8 raw slice with ICC profile for color management.
Use this for decoded images that have embedded ICC profiles (e.g., XYB JPEGs). The ICC profile will be used to transform pixels to sRGB before metric calculation.
Implementations§
Source§impl ImageData
impl ImageData
Sourcepub fn to_rgb8_vec(&self) -> Vec<u8> ⓘ
pub fn to_rgb8_vec(&self) -> Vec<u8> ⓘ
Convert to RGB8 slice representation.
Note: This does NOT apply ICC profile transformation. For ICC-aware
conversion, use [to_rgb8_srgb()] instead.
Sourcepub fn icc_profile(&self) -> Option<&[u8]>
pub fn icc_profile(&self) -> Option<&[u8]>
Get the ICC profile if present.
Sourcepub fn color_profile(&self) -> ColorProfile
pub fn color_profile(&self) -> ColorProfile
Get the color profile for this image.
Sourcepub fn to_rgb8_srgb(&self) -> Result<Vec<u8>>
pub fn to_rgb8_srgb(&self) -> Result<Vec<u8>>
Convert to sRGB RGB8 slice, applying ICC profile transformation if needed.
This is the ICC-aware version of [to_rgb8_vec()]. Use this when you need
the pixels in sRGB color space for metric calculation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageData
impl RefUnwindSafe for ImageData
impl Send for ImageData
impl Sync for ImageData
impl Unpin for ImageData
impl UnwindSafe for ImageData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more