edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Bounded header probes: format, size and EXIF orientation from the front of a file. |
| 2 | //! |
| 3 | //! [`probe`] and [`probe_reader`] read no pixels. They look at the signature, the |
| 4 | //! image header and the EXIF orientation, and at no more than [`PROBE_LIMIT`] |
| 5 | //! bytes of the file, so a probe of an arbitrarily large picture costs a bounded |
| 6 | //! read and a bounded allocation (none beyond the window itself). |
| 7 | //! |
| 8 | //! A probe reports what the bytes it saw say. An `eXIf`, `EXIF` or APP1 segment |
| 9 | //! that starts past the window is not seen, and the orientation reads as 1. |
| 10 | |
| 11 | use crate::; |
| 12 | use Error; |
| 13 | use Read; |
| 14 | |
| 15 | /// The most bytes a probe examines: 1 MiB. |
| 16 | pub const PROBE_LIMIT: usize = 1 << 20; |
| 17 | |
| 18 | /// Format, dimensions and orientation from the first [`PROBE_LIMIT`] bytes of |
| 19 | /// `prefix`. Bytes past the limit are ignored, not an error. |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | /// Format, dimensions and orientation from a reader. At most [`PROBE_LIMIT`] |
| 25 | /// bytes are read, and the reader is left positioned after them. |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 |