#[non_exhaustive]pub struct OpenOptions {
pub auto_orient: bool,
pub to_srgb: bool,
pub animated: bool,
pub limits: Limits,
}Expand description
How Image::open_with and Image::from_stream_with read an image.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.auto_orient: boolTurn the image upright as its metadata declares — EXIF Orientation
in JPEG, TIFF and WebP, irot/imir in AVIF — before any op.
On by default (SPEC §Safety and limits): a phone photograph is stored
sideways far more often than anyone wants it processed that way. Off,
pixels arrive as stored, and Image::orient applies an orientation
read some other way.
to_srgb: boolConvert pixels in an embedded ICC profile’s colour space to sRGB, the space every op and most consumers assume (SPEC §Pixel formats).
On by default, so a Display P3 phone photo or an Adobe RGB export
does not come out dull or garish. Off, pixels arrive as stored with
the profile attached (Image::icc_profile) and written into the
output, and Image::to_srgb converts later. A profile this cannot
convert is kept either way.
animated: boolAsk for every frame of an animated image rather than the first.
Reserved for the multi-frame pipeline, which is not implemented yet:
set, opening an animated GIF or WebP fails with
PixelsError::Unsupported rather than quietly processing one
frame, so code written against it today states its intent and starts
working when frames do. Off by default, as in sharp: the first frame
is the image, and Image::animation says what was left out.
limits: LimitsBounds on what a file may make the decoder allocate. A runtime facing untrusted uploads sets these per request; the default refuses images over 268 megapixels, as sharp does.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub const fn with_auto_orient(self, auto_orient: bool) -> Self
pub const fn with_auto_orient(self, auto_orient: bool) -> Self
The defaults with auto_orient replaced.
OpenOptions is #[non_exhaustive], so outside this crate a setter
is the only way to change a field.
Sourcepub const fn with_animated(self, animated: bool) -> Self
pub const fn with_animated(self, animated: bool) -> Self
The defaults with animated replaced.
Sourcepub const fn with_limits(self, limits: Limits) -> Self
pub const fn with_limits(self, limits: Limits) -> Self
The defaults with limits replaced.
Sourcepub const fn with_to_srgb(self, to_srgb: bool) -> Self
pub const fn with_to_srgb(self, to_srgb: bool) -> Self
The defaults with to_srgb replaced.