pub struct PdfImageXObject {
pub data: Vec<u8>,
pub width: u32,
pub height: u32,
pub color_space: ColorSpace,
pub bits_per_component: u8,
}Expand description
A JPEG-passthrough Image XObject surfaced by
DocumentReader::image_xobjects.
data is the raw, ready-to-decode JPEG byte sequence — exactly
the bytes a JPEG decoder needs to reconstruct the image. Any
upstream wrapping filters (e.g. /ASCII85Decode in /Filter [/ASCII85Decode /DCTDecode]) have been peeled off; the trailing
/DCTDecode filter is left as-is because applying it is the
JPEG decode step.
width / height come from the XObject’s /Width / /Height
entries (§8.9.5.1) — the PDF dictionary’s authoritative values.
They should match the JPEG’s intrinsic SOF0 marker dimensions; if
they don’t, the PDF dictionary wins for layout and the decoder
re-samples on the way out.
Fields§
§data: Vec<u8>Raw JPEG bytes — a self-contained JPEG-1 / JFIF stream ready to be passed to a JPEG decoder.
width: u32/Width from the XObject dict.
height: u32/Height from the XObject dict.
color_space: ColorSpace/ColorSpace mapped to a ColorSpace tag.
bits_per_component: u8/BitsPerComponent — 8 for the JPEG-1 baseline path; 12 for
the (rare) DCTDecode-with-12-bit-extended-process JPEGs.
Defaults to 8 when the dict is silent (the spec says it’s
required, but real-world PDFs occasionally omit it for
JPEG XObjects since the JPEG itself carries the value).
Trait Implementations§
Source§impl Clone for PdfImageXObject
impl Clone for PdfImageXObject
Source§fn clone(&self) -> PdfImageXObject
fn clone(&self) -> PdfImageXObject
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PdfImageXObject
impl Debug for PdfImageXObject
impl Eq for PdfImageXObject
Source§impl PartialEq for PdfImageXObject
impl PartialEq for PdfImageXObject
Source§fn eq(&self, other: &PdfImageXObject) -> bool
fn eq(&self, other: &PdfImageXObject) -> bool
self and other values to be equal, and is used by ==.