1use crate::{util::{read_u16, Endian}, ImageResult, ImageSize};
2use std::io::{BufRead, Seek, SeekFrom};
3
4pub fn size<R: BufRead + Seek>(reader: &mut R) -> ImageResult<ImageSize> {
5 reader.seek(pos:SeekFrom::Start(6))?;
6
7 Ok(ImageSize {
8 width: read_u16(reader, &Endian::Little)? as usize,
9 height: read_u16(reader, &Endian::Little)? as usize,
10 })
11}
12
13pub fn matches(header: &[u8]) -> bool {
14 header.starts_with(needle:b"GIF8")
15}
16