Skip to main content

Advanced plugin-based file conversion toolkit (CLI + Python API).

Project description

megaconvert

Plugin-based advanced file conversion toolkit with a clean Python API and a practical CLI.

  • ✅ CLI: megaconvert convert in.docx out.pdf
  • ✅ Python: from megaconvert import convert_file, convert_bytes
  • ✅ Extensible: add converters as plugins
  • ✅ “As many formats as possible”: uses best-in-class external engines when available

Reality check: there is no single pure-Python library that reliably converts everything to everything.
megaconvert solves this by providing one unified interface while delegating to proven tools (Pandoc, LibreOffice, FFmpeg, ImageMagick, …) when installed.


Features

Core

  • One API for documents, images, audio/video, ebooks, archives
  • Plugin registry with priorities (best converter wins)
  • Runtime capability detection (depends on installed tools)
  • Safe defaults with optional advanced flags (dpi, quality, custom args)

Highlights

  • Docs / Office: doc/docx/odt/rtf/xls/xlsx/ods/ppt/pptx/odppdf (LibreOffice)
  • Markup: md/html/xhtml/tex/latex/txtpdf/docx/odt/epub (Pandoc)
  • Media: audio/video + subtitle conversions (FFmpeg)
  • Images: raster & vector conversions (ImageMagick / Inkscape / Ghostscript)
  • Ebooks: epub ↔ mobi and more (Calibre)
  • Archives: zip/rar/7z/tar/gz/bz2/xz/tgz/iso repack/extract (7-Zip)
  • PDF utilities: page selection (pdf → pdf) in pure Python
  • Structured text: json/csv/tsv/yaml/xml/toml best-effort conversions

Supported formats (best-effort)

Documents / Text

txt pdf doc docx odt rtf md html xhtml epub mobi csv tsv xls xlsx ods json xml yaml yml ini toml log tex latex ps ppt pptx odp pdfa djvu odf sxw sxc sxm

Images / Graphics

jpg jpeg png gif bmp tiff tif webp svg svgz heic avif psd ai eps emf wmf ico icns ppm pgm pbm jp2 j2k mj2

Audio / Video / Subtitles

mp3 wav flac aac ogg m4a aiff wma mp4 mkv avi mov webm wmv flv ogv oga opus m3u m3u8 srt ass vtt lrc

Archives / Containers

zip rar 7z tar gz bz2 xz tgz iso cbr cbz

Actual support depends on installed external tools.
Run megaconvert capabilities to see what works on your machine.


Quickstart

Install package

pip install -e .

Optional Python extras:

pip install -e ".[dev,yaml,xml,toml,ocr]"

Verify installation

megaconvert list
megaconvert capabilities

Convert a file

megaconvert convert in.docx out.pdf
megaconvert convert in.png out.webp --quality 85
megaconvert convert in.mp4 out.mp3 --ff-args "-vn -b:a 192k"
megaconvert convert in.pdf out.pdf --pages "1-3,5"

External tools (recommended)

megaconvert delegates real work to proven tools when available.

    LibreOffice (soffice)  Office / ODF formats

    Pandoc  Markup & document conversions

    FFmpeg  Audio, video, subtitles

    ImageMagick (magick)  Raster images, PS/PDF routes

    Inkscape  SVG/SVGZ/EPS/PDF vector formats

    Ghostscript (gs)  PS/EPS/PDF, PDF/A

    Calibre (ebook-convert)  EPUB/MOBI and ebooks

    7-Zip (7z)  Archives

    DjVuLibre (ddjvu)  DjVu  PDF/images

    Tesseract  OCR (optional)

Installing external tools
Ubuntu / Debian

sudo apt update
sudo apt install -y \
  pandoc \
  libreoffice \
  ffmpeg \
  imagemagick \
  inkscape \
  ghostscript \
  p7zip-full \
  djvulibre-bin \
  tesseract-ocr \
  tesseract-ocr-hun

macOS (Homebrew)

brew install pandoc libreoffice ffmpeg imagemagick inkscape ghostscript p7zip djvulibre tesseract

Windows

Install tools manually or via Chocolatey and ensure they are on PATH:

    ffmpeg, pandoc, 7zip

    LibreOffice, ImageMagick, Inkscape, Ghostscript, Tesseract

CLI usage
List converters

megaconvert list

Show available conversion pairs

megaconvert capabilities

Check if a conversion is supported

megaconvert supports docx pdf

Convert

megaconvert convert in.docx out.pdf
megaconvert convert in.svg out.png --dpi 300
megaconvert convert in.mp4 out.webm --ff-args "-c:v libvpx -crf 30 -b:v 0"

Archives

# Extract archive
megaconvert convert archive.rar dummy.txt --archive-to extracted_dir

# Extract a single member
megaconvert convert archive.zip report.pdf --archive-member "docs/report.pdf"

Python usage
File  file

from megaconvert import convert_file

res = convert_file("in.docx", "out.pdf")
print(res.converter)

Bytes  bytes (web backend friendly)

from megaconvert import convert_bytes

with open("in.png", "rb") as f:
    out = convert_bytes(f.read(), "png", "webp", quality=80)

with open("out.webp", "wb") as f:
    f.write(out)

Capabilities / supports

from megaconvert import capabilities, supports

print(supports("docx", "pdf"))
caps = capabilities()

Conversion engines overview
Engine	Purpose
LibreOffice	Office/ODF  PDF and office formats
Pandoc	Markup & document conversions
FFmpeg	Audio/video/subtitles
ImageMagick	Raster images, PS/PDF rasterization
Inkscape	Vector graphics
Ghostscript	PS/EPS/PDF, PDF/A
Calibre	Ebook conversions
7-Zip	Archive repack/extract
DjVuLibre	DjVu conversions
Tesseract	OCR
Troubleshooting

    Tool not found  install it and ensure it’s on PATH

    ImageMagick PDF blocked  check policy.xml

    LibreOffice rendering issues  install common fonts

    Different capabilities on different machines  expected; tools differ

Security notes

If exposed as a public service:

    Run conversions in sandboxed containers

    Apply CPU/memory/time limits

    Treat uploaded files as untrusted input

Contributing

PRs welcome:

    New plugins

    Better format coverage

    Tests and docs improvements

pip install -e ".[dev]"
pytest

## License

This project is licensed under the **PolyForm Noncommercial License 1.0.0**.

-  Free for personal, educational, and internal use
-  Modification and redistribution allowed
-  Commercial use is **not permitted**

For commercial licensing, please contact the author.

Project details


Download files

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

Source Distribution

megaconvert-0.2.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

megaconvert-0.2.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file megaconvert-0.2.0.tar.gz.

File metadata

  • Download URL: megaconvert-0.2.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for megaconvert-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bcd3eb2190a1bc91d6f2ad13f50bb9efcb7c8a14b61d74bddba7205cbedbac4e
MD5 5325d5e8b2d936c1942648dffe9cae74
BLAKE2b-256 227f618f393a849d4990bf382b0c64603fb3b3ddcf3b1b67292ebf0ce38b683e

See more details on using hashes here.

File details

Details for the file megaconvert-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: megaconvert-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for megaconvert-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a10bc55c2e010567a31f7a46245a9d19b1d9220e61db9879bf57874213558a1
MD5 980cf1df7271aeffebf33121120e62cc
BLAKE2b-256 5ecc1cbbf7f93023300de1dcd35587085c49e5e1b73c663a2318573bd77ecfc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page