Skip to content

Repository files navigation

cnvrt

cnvrt is an interactive Go CLI for file conversion, extraction, archive creation, image resize/compression, and developer-oriented format tooling.

Run it with no arguments to pick files and an output format interactively, or pass paths and flags to convert straight away. Conversions are delegated to external tools when appropriate; structured data and archives are handled in-process with no dependencies.

Install

Homebrew (macOS / Linux)

brew install shellcell/tap/cnvrt

Linux packages (apt / dnf / apk)

Enable the shellcell repository once — setup instructions at https://packages.shellcell.dev — then:

sudo apt install cnvrt # Debian / Ubuntu
sudo dnf install cnvrt # Fedora / RHEL
sudo apk add cnvrt # Alpine

Go

go install github.com/shellcell/cnvrt/cmd/cnvrt@latest # Go 1.26+

Prebuilt binaries

Download the archive for your OS/arch from Releases; each contains the binary, man page, and shell completions. Or build from a clone with make build (both make build and make build-debug produce ./cnvrt).

Usage

cnvrt # pick inputs and output format interactively
cnvrt input.svg output.png # direct, by explicit path
cnvrt input.svg # pick the output format for one file
cnvrt -i svg -o png a.svg b.svg # batch, by format
cnvrt -o png ../../ # every supported file in a directory
cnvrt -o zip ./directory # create an archive
cnvrt archive.tar.gz # extract an archive
cnvrt --compress -o jpg photo.jpg # same-format compress
cnvrt --resize 800x -o png image.png # same-format resize
cnvrt -o json config.yaml # structured data, no external tool
cnvrt -o mp3 video.mp4 # extract audio
cnvrt --opt ffmpeg.audio_bitrate=320k -o mp3 song.wav

Commands

CommandPurpose
doctorWhich backends are installed, what they are for, how to install the missing ones
formatsKnown formats, grouped by category
backendsEach backend's description, required commands, and supported pairs
configEdit and save user settings interactively
add-format / add-toolRegister a new format or converter tool via config

Flags

FlagPurpose
-i, --input-formatOverride the detected input format
-o, --output-formatOutput format
--out-dirOutput directory
--overwriteOverwrite existing output files
--qualityBest-effort quality value for supported backends
--compressCompress same-format image output
--resizeResize value for supported image and video backends, e.g. 800x, 50%
--actionSame-format action: convert, compress, or resize
--optBackend option as tool.key=value, repeatable
-v, --versionPrint version and exit (also the version command)

How It Works

  • Output goes to the current directory by default; interactive mode offers to write beside each source instead.
  • Batches are tolerant. Supported files convert; unsupported and failed ones are listed in the final report, along with the exact command used for each job.
  • Backends are chosen by rank, but when several can handle a pair, interactive mode asks once per pair. Pin a choice with the backends setting to skip the question.
  • Commands are previewed before they run, and a single job's command can be edited. Non-terminal runs never prompt.
  • Missing tools don't hide formats. Unavailable outputs stay selectable, greyed out with the reason, and the report prints install commands for your host.
  • Prompts adapt to the input: extraction for a lone archive, archive creation for a directory, compress/resize/copy when input and output formats match, video and animation outputs for animated SVGs.
  • Backend options (audio bitrate, GIF fps, OCR language, 7z level, …) are offered interactively and scriptable via --opt.
  • Selectors are inline, not a full-screen TUI: j/k or arrows to move, / to filter, space to select, s to sort, q to quit. Non-terminal stdin falls back to numeric prompts.

Backends

BackendCommandTypical Use
structured(none)JSON, JSONL, YAML, TOML, CSV, TSV, INI, ENV, XML, PLIST, plus plain-text/Markdown rendering
archive(none)zip, tar, tar.gz, tar.bz2 extraction/creation
resvgresvgsvg -> png
animated-svgffmpeg + browseranimated SVG to video/animation formats
ImageMagickmagickcommon and legacy image conversions, resize, compression, background fill
FFmpegffmpegvideo, audio, GIF with palette, audio extraction from video
LibreOfficelibreofficeoffice documents
Pandocpandoctext, Markdown, HTML, EPUB, DOCX, TeX, RTF, RST, Org
Calibreebook-convertEPUB, MOBI, AZW3, FB2, PDF e-book workflows
GDALogr2ogrgeo/vector map formats
QEMUqemu-imgVM and disk image formats
7-Zip7zbroad archive/package extraction, compression level control
FontForgefontforgefont conversions, including outline-to-bitmap (bdf/pcf/fon)
Inkscapeinkscapesvg -> pdf/eps/ps, png fallback
Ghostscriptgsps/eps -> pdf, pdf -> ps, PDF re-compression
DjVuLibreddjvu/djvutxtdjvu -> pdf/tiff/txt
PopplerpdftotextPDF text layer extraction to txt/html
TesseracttesseractOCR: image -> txt or searchable PDF
GraphvizdotDOT diagrams to svg/png/pdf
MermaidmmdcMermaid diagrams to svg/png/pdf
Jupyterjupyternotebooks to html/markdown/script/pdf
TTSsay/espeak-ngtext to speech: txt/md -> wav/aiff/m4a
Whisperwhisperspeech to text: audio/video -> txt

Run cnvrt doctor to see what is available locally.

Formats

A known format is not the same as a supported conversion — real support depends on which backends are installed. Run cnvrt formats for the full catalog and cnvrt backends for actual pairs.

CategoryExamples
Imagespng, jpg, webp, bmp, tiff, gif, apng, avif, heic, ico, icns, psd, jp2, svg, pdf
Documentstxt, md, html, rtf, tex, docx, xlsx, csv, odt, ods, pptx, pdf
E-booksepub, fb2, mobi, azw3, djvu
Audio/videomp3, wav, flac, aac, m4a, ogg, opus, mp4, mov, avi, webm, mkv, flv
Archives/packageszip, tar, tar.gz, 7z, rar, deb, rpm, cpio, jar, apk, whl, gem, crate
Fontsttf, otf, woff, woff2, eot, bdf, pcf, fon, pfa, pfb
Geo/mapsgeojson, kml, gpx, shp, gpkg, osm, mbtiles, pmtiles, wkt, las
Schemas/APIsproto, openapi, jsonschema, graphql, thrift, avsc, capnp, xsd
VM/disk imagesraw, img, qcow2, vdi, vmdk, vhd, dmg, iso, ova

Structured-data conversions (json, yaml, toml, csv, ini, xml, plist, and friends) are built in and need no external commands. CSV input uses the first row as headers.

Settings

cnvrt config writes ~/.config/cnvrt/settings.json. A project-local ./cnvrt.settings.json and any paths in CNVRT_SETTINGS are layered on top.

{
"theme": "nord",
"ui": { "show_help": true },
"backends": { "svg->png": "resvg", "pdf": "ghostscript" },
"tools": { "ffmpeg": { "audio_bitrate": "320k" } }
}

backends pins a preferred backend per pair or per input format, tools sets default backend options, ui.show_help toggles the key-hint lines, and theme is nord or classic.

Extending With Config

New formats and tools can be added without code changes — cnvrt add-format and cnvrt add-tool generate the JSON interactively.

Tool config is loaded from ./cnvrt.tools.json, ./cnvrt.tools.d/*.json, ~/.config/cnvrt/tools.json, ~/.config/cnvrt/tools.d/*.json, and any paths in CNVRT_TOOL_CONFIG.

{
"formats": [
{ "name": "plantuml", "aliases": ["puml"], "extensions": ["puml"], "category": "diagram" }
],
"tools": [
{
"id": "plantuml",
"commands": ["plantuml"],
"capabilities": [{ "input": "plantuml", "output": "svg", "priority": 80 }],
"convert": { "command": "plantuml", "args": ["-tsvg", "{input}"] },
"install": [{ "manager": "brew", "package": "plantuml" }]
}
]
}

Placeholders: {input}, {output}, {input_format}, {output_format}, {quality}, {resize}, {action}. Install managers: brew, apt, dnf, yum, pacman, zypper, apk, npm, pnpm, yarn, pipx, pip, go, cargo, gem, composer.

Documentation

See docs/ARCHITECTURE.md for the layered architecture, ports, backend selection rules, and roadmap.