pub fn decode_image(
doc: &Document,
dict: &Dict,
raw: &[u8],
inline: bool,
) -> Result<CodedImage, ImageCodecError>Expand description
Decode an image stream through its /Filter chain.
Runs the byte-stream prefix of the chain through
pdfcer_model::filters, then dispatches the single terminal image codec.
A chain with no terminal codec still succeeds — it yields a
CodedImage with codec: None and
CodecColorModel::Unspecified, so the caller has one entry point
for every image rather than two code paths that can drift.
docresolves indirect values in the image and parameter dictionaries, and will resolve/JBIG2Globals(Table 12) and the/Heightfallback for CCITT’s absent/Rowswhen those codecs land.dictis the image dictionary (Table 89) or an inline image’s already-normalized parameter dictionary.rawis the still-encoded stream data.inlineselects §8.9.7’s stricter filter rules.
This is the base-revision entry point, kept with its original
&Document signature so that every existing caller — the four
image_codec_* fuzz targets, this module’s own tests, the
cmyk_variants acceptance test — is untouched by decision 018. It is a
thin wrapper over decode_image_view; a caller that must decode an
image as an editing session currently has it calls that directly.
§Errors
ImageCodecError — every failure is structured and names the
codec, and the specific unsupported feature where one applies
(rule R27). This function does not panic on any input; the
image_codec_dct fuzz target asserts it.