Commit c5f3bef1 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

Properly enable avif

parent 962c9897
This diff is collapsed.
......@@ -397,7 +397,7 @@ futures = "0.3.31"
futures-retry = "0.6.0"
futures-util = "0.3.31"
hashbrown = "0.14.5"
image = { version = "0.25.8", default-features = false }
image = { version = "0.25.9", default-features = false }
indexmap = "2.7.1"
indoc = "2.0.0"
inventory = "0.3.21"
......
......@@ -11,8 +11,8 @@ bench = false
[features]
# [NOTE]: Before enable this, ensure this can build all of the target platforms we support.
avif = ["image/avif"]
# [NOTE]: Before enabling this, ensure this can build all of the target platforms we support.
avif = ["image/avif", "image/avif-native"]
webp = ["image/webp"]
[lints]
......
......@@ -82,27 +82,6 @@ pub struct BlurPlaceholderOptions {
pub size: u32,
}
fn extension_to_image_format(extension: &str) -> Option<ImageFormat> {
Some(match extension {
"avif" => ImageFormat::Avif,
"jpg" | "jpeg" => ImageFormat::Jpeg,
"png" => ImageFormat::Png,
"gif" => ImageFormat::Gif,
"webp" => ImageFormat::WebP,
"tif" | "tiff" => ImageFormat::Tiff,
"tga" => ImageFormat::Tga,
"dds" => ImageFormat::Dds,
"bmp" => ImageFormat::Bmp,
"ico" => ImageFormat::Ico,
"hdr" => ImageFormat::Hdr,
"exr" => ImageFormat::OpenExr,
"pbm" | "pam" | "ppm" | "pgm" => ImageFormat::Pnm,
"ff" | "farbfeld" => ImageFormat::Farbfeld,
"qoi" => ImageFormat::Qoi,
_ => return None,
})
}
fn result_to_issue<T>(source: ResolvedVc<Box<dyn Source>>, result: Result<T>) -> Option<T> {
match result {
Ok(r) => Some(r),
......@@ -148,7 +127,7 @@ fn load_image_internal(
.context("unable to determine image format from file content")?;
let mut format = reader.format();
if format.is_none()
&& let Some(new_format) = extension_to_image_format(extension)
&& let Some(new_format) = ImageFormat::from_extension(extension)
{
format = Some(new_format);
reader.set_format(new_format);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment