mod image;
mod wxgf;
pub use image::ImageInspection;
pub use wxgf::wxgf_preview;
pub const MAX_IMAGE_BYTES: usize = 16 * 1024 * 1024;
pub const MAX_FILE_BYTES: usize = 512 * 1024 * 1024;
pub const MAX_VIDEO_SOURCE_BYTES: usize = 50 * 1024 * 1024;
#[derive(Debug)]
pub struct DecodedImage {
pub bytes: Vec<u8>,
pub inspection: ImageInspection,
}
pub fn inspect_image(bytes: &[u8]) -> anyhow::Result<ImageInspection> {
if bytes.starts_with(b"wxgf") {
let mut inspection = wxgf_preview(bytes)?.inspection;
inspection.content_type = "image/x-wxgf".into();
inspection.animation_preserved = false;
return Ok(inspection);
}
image::inspect_standard_image(bytes)
}