pub enum DecodeError {
Show 18 variants
NotJpeg,
Truncated,
MalformedSegment {
marker: u8,
},
UnknownMarker(u8),
UnsupportedProcess {
marker: u8,
},
UnsupportedPrecision(u8),
UnsupportedComponents(u8),
EmptyImage,
TooLarge {
width: u16,
height: u16,
},
InvalidSampling,
DuplicateMarker(u8),
MissingFrame,
MissingTable {
kind: TableKind,
index: u8,
},
InvalidHuffmanTable,
InvalidHuffmanCode,
CoefficientOverflow,
InvalidScan,
MissingRestart {
expected: u8,
},
}Expand description
Why a JPEG file could not be decoded.
Variants§
NotJpeg
The data does not start with a JPEG start-of-image marker.
Truncated
The data ends before the image does.
MalformedSegment
A marker segment is too short, too long or holds invalid values.
UnknownMarker(u8)
A marker that has no meaning in a JPEG file.
UnsupportedProcess
The frame uses a coding process the decoder does not implement: arithmetic coding, lossless or hierarchical JPEG.
UnsupportedPrecision(u8)
Samples of another precision than 8 bits.
UnsupportedComponents(u8)
Another number of components than 1, 3 or 4.
EmptyImage
A side of the frame is zero.
TooLarge
The image has more pixels than the input can hold, or than Pillow accepts.
InvalidSampling
Sampling factors outside 1–4, ratios that are not whole numbers, or an MCU of more than ten blocks.
DuplicateMarker(u8)
A second start-of-frame or start-of-image marker.
MissingFrame
A scan before the frame header, or an end of image before any scan.
MissingTable
A scan refers to a table that was never defined.
InvalidHuffmanTable
A Huffman table whose code lengths do not form a prefix code, or a DC table with symbols above 15.
InvalidHuffmanCode
The entropy-coded data holds a bit sequence that is not a code.
CoefficientOverflow
Progressive DC differences add up past the range of an int,
which libjpeg rejects.
InvalidScan
A scan header names an unknown or repeated component, or has spectral selection or successive approximation parameters that are not valid for a progressive scan.
MissingRestart
The restart marker expected after a restart interval is missing.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()