pub enum StillFormat {
Show 16 variants
Jpeg,
Png,
WebP,
Jxl,
Tiff,
Gif,
Ppm,
Avif,
Heic,
Arw,
Cr2,
Cr3,
Crw,
Dng,
Nef,
Raf,
}Expand description
The closed set of still-image formats Capsule models.
Closed on purpose: a still Capsule cannot name is not a still it silently ignores, it is a
MediaError::NotAStillImage. Membership here says
“Capsule knows this is a photo”; is_decodable says whether this
build can read its pixels. The two are deliberately separate — that gap is what
DerivativeStatus::DeferredNoCodec reports.
Variants§
Jpeg
JPEG / JFIF. Decoded by gamut-jpeg.
Png
PNG. Decoded by gamut-png; alpha is flattened at the decode boundary.
WebP
WebP. Recognised, not decoded. rawshift-image’s WebP is pure-Rust gamut-webp at
the pinned revision, so it would build for every target, but its webp-decode feature is
not enabled here: turning a format on is its own change, with its own fixtures.
Jxl
JPEG XL. Decoded by gamut-jxl (jxl-rs). Encode needs C++ libjxl (media-linked-codecs).
Tiff
TIFF. Decoded by the tiff crate. Also the container of most RAW families.
Gif
GIF. Decoded by gif; the first frame only.
Ppm
Netpbm (P5/P6/P7/PFM). Recognised, not decoded: the ppm-decode backend is deliberately
not enabled. Netpbm is an intermediate and test-fixture format rather than something a
photo library holds, so recognising it and deferring is the honest outcome — and it costs
one fewer dependency than a codec nobody’s library needs.
Avif
AVIF. Decoded by gamut-avif under the opt-in media-avif-decode feature, its AV1
codestream through a hardware decoder where the host has one; recognised and refused
without the feature, and deferred at decode on a host with no AV1 decoder or whose
hardware decoder refuses the codestream’s profile.
Heic
HEIC / HEIF. Recognised, never decoded: libheif and its HEVC decoder libde265 are LGPL-3.0, which licence policy excludes (issue #588).
Arw
Sony ARW. Decoded by rawshift-image’s RAW pipeline (issue #589) where the raw frame is
lossless JPEG (compression 7, Sony’s “lossless compressed” mode on current bodies); the
uncompressed and lossy “compressed RAW” modes have no upstream decoder and defer as an
unsupported variant.
Cr2
Canon CR2.
Cr3
Canon CR3.
Crw
Canon CRW.
Dng
Adobe DNG (including Apple ProRAW). Decoded by rawshift-image’s RAW pipeline (issue
#589) where the raw IFD is uncompressed, lossless JPEG or JPEG XL (ProRAW); a DNG with
a Deflate image defers as an unsupported variant until upstream bounds its inflate
(visualcommons/rawshift#82).
Nef
Nikon NEF.
Raf
Fujifilm RAF.
Implementations§
Source§impl StillFormat
impl StillFormat
Sourcepub fn is_decodable(self) -> bool
pub fn is_decodable(self) -> bool
Whether this build can read pixels out of the format — the single codec-coverage predicate, and the gate the decode path checks before touching a decoder.
Sourcepub fn is_raw(self) -> bool
pub fn is_raw(self) -> bool
Whether the format is one of the RAW families, which decode through rawshift-image’s RAW
pipeline rather than its standard-image one. Their container is TIFF or ISO-BMFF, so the
extension is what names the family. Only ARW and DNG are also
decodable.
Sourcepub const fn mime(self) -> &'static str
pub const fn mime(self) -> &'static str
The canonical media type — what the sidecar’s content_type carries when detection
succeeded.
Sourcepub fn from_extension(ext: &str) -> Option<Self>
pub fn from_extension(ext: &str) -> Option<Self>
The lowercase extension table — the fallback, used only where a header cannot settle the question (see the module docs). Extensions arrive lowercased.
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Sniff the format from the file header alone.
None means “no still image Capsule models starts like this” — a video, an SVG, an XMP
sidecar, or noise. A RAW file sniffs to its container here (Tiff, or
None for CR3’s unrecognised ftyp brand); detect is what refines it.
Each signature carries its own length requirement rather than sharing one floor: a Netpbm header is eleven bytes and a JPEG’s SOI three, so a blanket minimum would report a perfectly well-formed short file as “not an image”.
Trait Implementations§
Source§impl Clone for StillFormat
impl Clone for StillFormat
Source§fn clone(&self) -> StillFormat
fn clone(&self) -> StillFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StillFormat
Source§impl Debug for StillFormat
impl Debug for StillFormat
Source§impl Display for StillFormat
impl Display for StillFormat
impl Eq for StillFormat
Source§impl Hash for StillFormat
impl Hash for StillFormat
Source§impl PartialEq for StillFormat
impl PartialEq for StillFormat
Source§fn eq(&self, other: &StillFormat) -> bool
fn eq(&self, other: &StillFormat) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StillFormat
Auto Trait Implementations§
impl Freeze for StillFormat
impl RefUnwindSafe for StillFormat
impl Send for StillFormat
impl Sync for StillFormat
impl Unpin for StillFormat
impl UnsafeUnpin for StillFormat
impl UnwindSafe for StillFormat
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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