Skip to main content

StillFormat

Enum StillFormat 

Source
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

Source

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.

Source

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.

Source

pub const fn mime(self) -> &'static str

The canonical media type — what the sidecar’s content_type carries when detection succeeded.

Source

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.

Source

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”.

Source

pub fn detect(bytes: &[u8], ext: &str) -> Option<Self>

Identify a still: header first, extension only where a header cannot settle it.

ext is the source file’s lowercase extension without the dot ("" when it has none). The two extension-consulting cases are documented on the module.

Trait Implementations§

Source§

impl Clone for StillFormat

Source§

fn clone(&self) -> StillFormat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StillFormat

Source§

impl Debug for StillFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for StillFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The format’s media type — what a log line and an error message both want.

Source§

impl Eq for StillFormat

Source§

impl Hash for StillFormat

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StillFormat

Source§

fn eq(&self, other: &StillFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StillFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more