From 1def7199bed59eed359f5c2c0d468f3deca17eac Mon Sep 17 00:00:00 2001 From: Alex Drozdoff Date: Wed, 12 Jan 2022 22:17:22 +1300 Subject: [PATCH] Add new magic byte Add compatibility with .avif files created via libheif --- src/io/free_functions.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/io/free_functions.rs b/src/io/free_functions.rs index 1323962d84..2788df16dd 100644 --- a/src/io/free_functions.rs +++ b/src/io/free_functions.rs @@ -252,7 +252,7 @@ pub(crate) fn write_buffer_impl( } } -static MAGIC_BYTES: [(&[u8], ImageFormat); 21] = [ +static MAGIC_BYTES: [(&[u8], ImageFormat); 22] = [ (b"\x89PNG\r\n\x1a\n", ImageFormat::Png), (&[0xff, 0xd8, 0xff], ImageFormat::Jpeg), (b"GIF89a", ImageFormat::Gif), @@ -273,6 +273,7 @@ static MAGIC_BYTES: [(&[u8], ImageFormat); 21] = [ (b"P7", ImageFormat::Pnm), (b"farbfeld", ImageFormat::Farbfeld), (b"\0\0\0 ftypavif", ImageFormat::Avif), + (b"\0\0\0\x1cftypavif", ImageFormat::Avif), (&[0x76, 0x2f, 0x31, 0x01], ImageFormat::OpenExr), // = &exr::meta::magic_number::BYTES ];