Skip to content

Commit

Permalink
fix: added more image formats
Browse files Browse the repository at this point in the history
  • Loading branch information
SalOne22 committed Jan 20, 2024
1 parent 23f8252 commit 15aebe6
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions src/config/image_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ pub enum ImageFormat {
Png,
/// TIFF image format.
Tiff,
/// GIF image format.
Gif,
/// TGA image format.
Tga,
/// DDS image format.
Dds,
/// BMP image format.
Bmp,
/// ICO image format.
Ico,
/// Radiance HDR image format.
Hdr,
/// OpenEXR image format.
OpenExr,
/// General PNM image format.
Pnm,
/// Farbfeld image format.
Farbfeld,
/// QOI image format.
Qoi,
/// JPEG XL image format.
#[cfg(feature = "jxl")]
JpegXl,
Expand Down Expand Up @@ -55,15 +75,25 @@ impl ImageFormat {
.to_lowercase()
.as_str()
{
#[cfg(feature = "avif")]
"avif" => Self::Avif,
"jpg" | "jpeg" => Self::Jpeg,
"png" => Self::Png,
"tiff" | "tif" => Self::Tiff,
#[cfg(feature = "jxl")]
"jxl" => Self::JpegXl,
"gif" => Self::Gif,
#[cfg(feature = "webp")]
"webp" => Self::WebP,
#[cfg(feature = "avif")]
"avif" => Self::Avif,
"tif" | "tiff" => Self::Tiff,
"tga" => Self::Tga,
"dds" => Self::Dds,
"bmp" => Self::Bmp,
"ico" => Self::Ico,
"hdr" => Self::Hdr,
"exr" => Self::OpenExr,
"pbm" | "pam" | "ppm" | "pgm" => Self::Pnm,
"ff" | "farbfeld" => Self::Farbfeld,
"qoi" => Self::Qoi,
#[cfg(feature = "jxl")]
"jxl" => Self::JpegXl,
ext => return Err(ImageFormatError::Unknown(ext.to_string())),
},
)
Expand Down

0 comments on commit 15aebe6

Please sign in to comment.