Enum matrix_qrcode::image::ImageFormat
[−]pub enum ImageFormat {
Show 13 variants
Png,
Jpeg,
Gif,
WebP,
Pnm,
Tiff,
Tga,
Dds,
Bmp,
Ico,
Hdr,
Farbfeld,
Avif,
// some variants omitted
}
Expand description
An enumeration of supported image formats. Not all formats support both encoding and decoding.
Variants
Png
An Image in PNG Format
Jpeg
An Image in JPEG Format
Gif
An Image in GIF Format
WebP
An Image in WEBP Format
Pnm
An Image in general PNM Format
Tiff
An Image in TIFF Format
Tga
An Image in TGA Format
Dds
An Image in DDS Format
Bmp
An Image in BMP Format
Ico
An Image in ICO Format
Hdr
An Image in Radiance HDR Format
Farbfeld
An Image in farbfeld Format
Avif
An Image in AVIF format.
Implementations
impl ImageFormat
impl ImageFormat
pub fn from_extension<S>(ext: S) -> Option<ImageFormat> where
S: AsRef<OsStr>,
pub fn from_extension<S>(ext: S) -> Option<ImageFormat> where
S: AsRef<OsStr>,
Return the image format specified by a path’s file extension.
Example
use image::ImageFormat;
let format = ImageFormat::from_extension("jpg");
assert_eq!(format, Some(ImageFormat::Jpeg));
pub fn from_path<P>(path: P) -> Result<ImageFormat, ImageError> where
P: AsRef<Path>,
pub fn from_path<P>(path: P) -> Result<ImageFormat, ImageError> where
P: AsRef<Path>,
Return the image format specified by the path’s file extension.
Example
use image::ImageFormat;
let format = ImageFormat::from_path("images/ferris.png")?;
assert_eq!(format, ImageFormat::Png);
pub fn extensions_str(self) -> &'static [&'static str]
pub fn extensions_str(self) -> &'static [&'static str]
Return a list of applicable extensions for this format.
All currently recognized image formats specify at least on extension but for future compatibility you should not rely on this fact. The list may be empty if the format has no recognized file representation, for example in case it is used as a purely transient memory format.
The method name extensions
remains reserved for introducing another method in the future
that yields a slice of OsStr
which is blocked by several features of const evaluation.
Trait Implementations
impl Clone for ImageFormat
impl Clone for ImageFormat
fn clone(&self) -> ImageFormat
fn clone(&self) -> ImageFormat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for ImageFormat
impl Debug for ImageFormat
impl From<ImageFormat> for ImageOutputFormat
impl From<ImageFormat> for ImageOutputFormat
fn from(fmt: ImageFormat) -> ImageOutputFormat
fn from(fmt: ImageFormat) -> ImageOutputFormat
Converts to this type from the input type.
impl From<ImageFormat> for ImageFormatHint
impl From<ImageFormat> for ImageFormatHint
fn from(format: ImageFormat) -> ImageFormatHint
fn from(format: ImageFormat) -> ImageFormatHint
Converts to this type from the input type.
impl Hash for ImageFormat
impl Hash for ImageFormat
impl PartialEq<ImageFormat> for ImageFormat
impl PartialEq<ImageFormat> for ImageFormat
fn eq(&self, other: &ImageFormat) -> bool
fn eq(&self, other: &ImageFormat) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &ImageFormat) -> bool
fn ne(&self, other: &ImageFormat) -> bool
This method tests for !=
.
impl Copy for ImageFormat
impl Eq for ImageFormat
impl StructuralEq for ImageFormat
impl StructuralPartialEq for ImageFormat
Auto Trait Implementations
impl RefUnwindSafe for ImageFormat
impl Send for ImageFormat
impl Sync for ImageFormat
impl Unpin for ImageFormat
impl UnwindSafe for ImageFormat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more