Input Format and Image Support#
InputFormat Enum#
InputFormat is a str-based enum defined in docling/datamodel/base_models.py that enumerates every document type Docling can ingest. As of the current codebase it has 26 values:
| Category | Values |
|---|---|
| Office / productivity | DOCX, DOC, PPTX, PPT, XLSX, XLS, ODT, ODS, ODP |
| Web / text | HTML, MD, ASCIIDOC, CSV, LATEX, EMAIL, EPUB, BOXNOTE |
| Raster images | IMAGE |
| Page-based / archival | PDF, METS_GBS, DCLX |
| XML / structured data | XML_USPTO, XML_JATS, XML_XBRL, XML_DOCLANG, JSON_DOCLING |
| Media | AUDIO, VIDEO, VTT |
Each format maps to its accepted file extensions via FormatToExtensions and to MIME types via FormatToMimeType. Both dictionaries live in the same file and are the authoritative lookup tables used for format detection.
InputFormat is consumed by DocumentConverter as the key in its format_options dictionary, which maps each format to a FormatOption controlling pipeline class, pipeline options, and backend options.
InputFormat.IMAGE — Raster Image Handling#
InputFormat.IMAGE covers PNG, JPEG, TIFF, BMP, and WEBP raster files . The associated MIME types are image/png, image/jpeg, image/tiff, image/gif, image/bmp, and image/webp .
Backend: Images are processed by ImageDocumentBackend (docling/backend/image_backend.py), a PaginatedDocumentBackend that feeds into StandardPdfPipeline (the same pipeline used for PDFs). At initialization it eagerly loads all image frames for thread safety :
- Multi-frame formats (TIFF, GIF, ICO): each frame becomes a separate page via
img.seek(i). - Single-frame formats (JPEG, PNG, BMP, WEBP): one frame, one page.
FormatOption: Images use ImageFormatOption pre-wired with StandardPdfPipeline and ImageDocumentBackend.
SVG and Vector Format Exclusions#
Docling explicitly skips vector formats in two independent locations:
1. ImageResourceLoader.load_image_data (docling/backend/utils/image_resource_loader.py)
Any .svg path is rejected immediately — the method returns None before attempting any further loading. This guard applies broadly across backends that resolve inline image references (e.g., HTML, Markdown, PPTX).
2. _odf_image_can_be_bitmap (docling/backend/opendocument_backend.py)
For ODF documents (ODT/ODS/ODP), this helper checks images before extraction using a two-stage filter:
- If a MIME type is available: accept only
image/*types, explicitly rejectingimage/svg+xml. - If falling back to file extension: reject
.svg,.pdf,.emf,.wmf; accept only.bmp,.gif,.jpeg,.jpg,.png,.tif,.tiff,.webp.
The ODF image extraction pipeline calls this check before _image_ref_from_odf_image adds a PictureItem to the DoclingDocument.
Key Files#
| File | Role |
|---|---|
docling/datamodel/base_models.py | InputFormat enum, FormatToExtensions, FormatToMimeType |
docling/backend/image_backend.py | ImageDocumentBackend — raster image loading and frame splitting |
docling/backend/utils/image_resource_loader.py | SVG skip guard in load_image_data |
docling/backend/opendocument_backend.py | _odf_image_can_be_bitmap — vector format filter for ODF |
docling/document_converter.py | ImageFormatOption, FormatOption mapping, pipeline wiring |