Skip to main content

docx2img

A pure Python .docx → image rendering engine. No Microsoft Office or LibreOffice required.

Features

  • Paragraphs, runs, fonts, colors, bold/italic/underline/strikethrough
  • Full style inheritance and theme resolution
  • Tables with merged cells, nested tables, and borders
  • Inline images and floating images with text wrap
  • Multi-section documents, landscape pages, multi-column layout
  • Headers, footers, and page numbers
  • Ordered / unordered lists with numbering
  • Word-style pagination with widow/orphan control and cross-page tables
  • CJK line breaking, punctuation hanging, justification, and document-grid layout
  • Justified text, tab stops, text boxes
  • OMML math (fractions, super/subscripts, radicals, accents, bars, limits, equation arrays)
  • Footnotes and endnotes with continuation pages
  • DrawingML and legacy VML shapes, text boxes, flowchart nodes, and arrows

Installation

pip install docx2img

Usage

CLI

docx2img input.docx output.png --dpi 150

Python API

from docx2img import Config, convert, convert_to_images

# A multi-page document is saved as output_1.png, output_2.png, ...
convert("input.docx", "output.png", dpi=150)

# Per-page images
pages = convert_to_images("input.docx", Config(dpi=150))
for i, img in enumerate(pages):
    img.save(f"page_{i + 1}.png")

Development

pip install -e ".[dev]"
python -m pytest tests/ -v

See docs/technical_design.md for architecture details.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docx2img-0.1.2.tar.gz (114.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docx2img-0.1.2-py3-none-any.whl (131.0 kB view details)

Uploaded Python 3

File details

Details for the file docx2img-0.1.2.tar.gz.

File metadata

  • Download URL: docx2img-0.1.2.tar.gz
  • Upload date:
  • Size: 114.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for docx2img-0.1.2.tar.gz
Algorithm Hash digest
SHA256 14ab1f2468c2ba856970d2eda62411a78a575d710aa11c44427191abdef28ec5
MD5 1043172e24f02152f98db46f21f785aa
BLAKE2b-256 2c9c75c08c4a6295dad04ec7dbaa947af7a530a27c6e28a00b44eb13599c6af5

See more details on using hashes here.

Provenance

The following attestation bundles were made for docx2img-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on HuiTurn/docx2img

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docx2img-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: docx2img-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 131.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for docx2img-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84e3c65dab0aeec4261e0d6d7a140b5c9ca88ac2cfcb93424c36471b03b7cdfa
MD5 afe6fd1321dff6759625ced48ba13137
BLAKE2b-256 6119011135bce3d87e031b6c6f45c9186de334b12035d8c659c9df26d06071a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for docx2img-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on HuiTurn/docx2img

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page