pub struct Image { /* private fields */ }images only.Expand description
Immutable owned image bytes with a stable, process-unique reference.
Cloning preserves reference identity. References are opaque tokens, not security capabilities and not portable serialization identifiers.
Implementations§
Source§impl Image
impl Image
Sourcepub fn from_bytes(data: impl Into<Arc<[u8]>>) -> Result<Self>
pub fn from_bytes(data: impl Into<Arc<[u8]>>) -> Result<Self>
Inspect owned bytes without decoding or modifying pixels.
§Errors
Returns InvalidImage for unsupported signatures, malformed inspected
headers, animation, file/dimension/area limit violations, or exhausted
reference identities. Successful inspection does not prove pixel decodability.
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self>
pub fn from_path(path: impl AsRef<Path>) -> Result<Self>
Read a caller-selected local path, with a bounded read and redacted errors.
§Errors
Returns InvalidImage if the file cannot be opened/read or its bytes
fail Image::from_bytes validation. Errors omit the supplied path.
Sourcepub fn from_base64(text: &str) -> Result<Self>
pub fn from_base64(text: &str) -> Result<Self>
Decode standard padded base64, ignoring whitespace; data URLs are rejected.
§Errors
Returns InvalidImage for a data-URL prefix, invalid base64, excessive
encoded/decoded size, or any Image::from_bytes validation failure.
Sourcepub fn format(&self) -> ImageFormat
pub fn format(&self) -> ImageFormat
Encoding discovered from the file signature.
Sourcepub fn placeholder(&self) -> &str
pub fn placeholder(&self) -> &str
Opaque reference to embed in state or question strings.
Sourcepub fn diagnostics(&self) -> &[ImageDiagnostic]
pub fn diagnostics(&self) -> &[ImageDiagnostic]
Metadata observations that have not been applied to the pixels.