You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently, using image::load_from_memory will make an attempt to guess the image's format using magic numbers at the beginning of the image's bytes. WebP's magic bytes are defined here:
static MAGIC_BYTES: [(&'static [u8], ImageFormat); 11] = [
//omitted other definitions
(b"WEBP", ImageFormat::WEBP),
//omitted other definitions
];
This would cause any byte sequence starting with the bytes for "WEBP" to be recognized as WebP images; however, WebP images do not actually begin with the ASCII bytes "WEBP", but instead, their file header looks like this:
That's true, but right now this crate only supports WebP anyways, and the other image formats that use RIFF seem pretty low priority
Regardless, detecting that it's a RIFF container seems like the first step for detecting if it's any of these formats to me
Presently, using
image::load_from_memory
will make an attempt to guess the image's format using magic numbers at the beginning of the image's bytes. WebP's magic bytes are defined here:This would cause any byte sequence starting with the bytes for "WEBP" to be recognized as WebP images; however, WebP images do not actually begin with the ASCII bytes "WEBP", but instead, their file header looks like this:
(taken from the WebP Container Specification)
Because of this, WEBP images' bytes are not properly recognized by
load_from_memory
.The text was updated successfully, but these errors were encountered: