pub struct ImageExtractionConfig {Show 15 fields
pub extract_images: bool,
pub target_dpi: i32,
pub max_image_dimension: i32,
pub inject_placeholders: bool,
pub auto_adjust_dpi: bool,
pub min_dpi: i32,
pub max_dpi: i32,
pub max_images_per_page: Option<u32>,
pub classify: bool,
pub include_page_rasters: bool,
pub run_ocr_on_images: bool,
pub ocr_text_only: bool,
pub append_ocr_text: bool,
pub output_format: ImageOutputFormat,
pub include_data_base64: bool,
}Expand description
Image extraction configuration.
Fields§
§extract_images: boolExtract images from documents
target_dpi: i32Target DPI for image normalization
max_image_dimension: i32Maximum dimension for images (width or height)
inject_placeholders: boolWhether to inject image reference placeholders into markdown output.
When true (default), image references like 
are appended to the markdown. Set to false to extract images as data
without polluting the markdown output.
auto_adjust_dpi: boolAutomatically adjust DPI based on image content
min_dpi: i32Minimum DPI threshold
max_dpi: i32Maximum DPI threshold
max_images_per_page: Option<u32>Maximum number of image objects to extract per PDF page.
Some PDFs (e.g. technical diagrams stored as thousands of raster fragments) can trigger extremely long or indefinite extraction times when every image object on a dense page is decoded individually via the PDF extractor. Setting this limit causes xberg to stop collecting individual images once the count per page reaches the cap and emit a warning instead.
None (default) means no limit — all images are extracted.
classify: boolWhen true, extracted images are classified by kind and grouped
into clusters where they appear to belong to one figure.
Defaults to false — opt in explicitly to avoid unexpected ML overhead.
include_page_rasters: boolWhen true, full-page renders produced during OCR preprocessing are captured
and returned as ImageKind::PageRaster entries in ExtractedDocument.images.
PDF + OCR only. No rasters are captured for non-PDF inputs or when the
document-level OCR bypass is active (whole-document backend). When OCR is
enabled and this flag is set but the active backend skips per-page rendering,
a ProcessingWarning is emitted in ExtractedDocument.processing_warnings.
Defaults to false. Enable when downstream consumers need page thumbnails
(e.g. citation previews, visual grounding).
run_ocr_on_images: boolRun OCR on extracted images and include the recognized text in the document content.
When true (default) and ExtractionConfig.ocr is configured, extracted images
are processed with the configured OCR backend. Set to false to extract images
without OCR processing, even when OCR is enabled.
ocr_text_only: boolWhen true, image OCR results are rendered as plain text without the
 markdown placeholder. Only takes effect when run_ocr_on_images
is also true.
append_ocr_text: boolWhen true and ocr_text_only is false, append the OCR text after
the image placeholder in the rendered output.
output_format: ImageOutputFormatTarget format for re-encoding extracted images.
When set to anything other than Native, each extracted image is
re-encoded to the requested format before being returned. This lets
callers receive uniform output without duplicating encode logic
downstream.
Defaults to Native — no re-encode pass is performed and
ExtractedImage.format reflects the source extractor’s output.
include_data_base64: boolWhen true, populate ExtractedImage::data_base64 with a Base64-encoded
copy of the raw image bytes.
Useful for JSON-only clients that cannot efficiently parse the default
integer-array serialization of data. Defaults to false; enabling it
doubles the in-memory image representation for the duration of the response.
Trait Implementations§
Source§impl Clone for ImageExtractionConfig
impl Clone for ImageExtractionConfig
Source§fn clone(&self) -> ImageExtractionConfig
fn clone(&self) -> ImageExtractionConfig
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 ImageExtractionConfig
impl Debug for ImageExtractionConfig
Source§impl Default for ImageExtractionConfig
impl Default for ImageExtractionConfig
Source§impl<'de> Deserialize<'de> for ImageExtractionConfig
impl<'de> Deserialize<'de> for ImageExtractionConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ImageExtractionConfig
impl RefUnwindSafe for ImageExtractionConfig
impl Send for ImageExtractionConfig
impl Sync for ImageExtractionConfig
impl Unpin for ImageExtractionConfig
impl UnsafeUnpin for ImageExtractionConfig
impl UnwindSafe for ImageExtractionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more