Takumi

CLI reference

Every takumi command and flag, with its default, plus the exit codes and file limits.

takumi --help and takumi <command> --help print the same flags from the binary you have installed.

Commands

CommandWhat it does
takumi image <input>Renders an HTML file to a PNG, JPEG, WebP, or SVG image.
takumi pdf <input>Renders an HTML file to a paged PDF.
takumi paint <input>Writes what painting an HTML file draws, as text or JSON.
takumi upgradeReinstalls takumi from the source Cargo installed it from.

Commands must be written in full. takumi im is an error, not takumi image.

Global flags

FlagEffect
-q, --quietHides warnings. 1
-h, --helpPrints help for the command.
-V, --versionPrints the version.

1 --quiet still prints errors.

Input and output

takumi image, takumi pdf, and takumi paint all take these:

FlagDefaultEffect
<input>The HTML file to render, or - for standard input.
-o, --output <file>The file to write, or - for standard output. 1
--list-resourcesLists the files the document would load and whether it may, without rendering.
--font <file>Registers a font file. 2
--root <dir>The input file's directory, or none for standard inputThe directory the document may read.
--allow-read <dir>Another directory the document may read. 2

1 -o is required unless --list-resources is set.

2 Repeat --font or --allow-read to add more.

takumi image

FlagDefaultEffect
--width <px>1200The viewport width in CSS pixels.
--height <px>The content's heightThe viewport height in CSS pixels.
--dpr <ratio>1The device pixel ratio. 1
--format <format>From the output's extensionpng, jpeg (or jpg), webp, or svg. 2
--quality <0-100>75 for JPEG, lossless for WebPThe encoding quality. 3

1 The image is width × dpr by height × dpr pixels, and may hold at most 64 megapixels.

2 --format is required with -o -, since standard output has no extension.

3 Setting --quality makes WebP lossy. PNG and SVG ignore it.

takumi pdf

FlagDefaultEffect
--page <size>A4The page size, as the CSS size property takes it, such as letter landscape or 210mm 297mm.
--margin <margin>1cm, grown to fit a header or footerThe page margins, as the CSS margin property takes them, such as 20mm or 1in 0.75in.
--pages <ranges>Every pageThe pages to keep, such as 1-3,8 or 5-. 1
--header <file>An HTML file drawn in the top margin of every page.
--footer <file>An HTML file drawn in the bottom margin of every page.
--title <title>The title a PDF viewer shows.
--author <name>An author of the document. 2
--outlineAdds bookmarks for the h1 to h6 headings.
--background <color>A CSS color that fills every page, margins included.

1 Kept pages keep their numbers from the whole document.

2 Repeat --author to add more authors.

A @page rule in the document wins over --page and --margin. In a header or footer, an element with the class pageNumber or totalPages shows the page number or the page count.

takumi paint

FlagDefaultEffect
--width <px>1200The viewport width in CSS pixels.
--height <px>The content's heightThe viewport height in CSS pixels.
--dpr <ratio>1The device pixel ratio.
--detail <detail>nodesnodes, drawables, or full. 1
--format <format>From the output's extensiontext or json. 2

1 See what a document paints shows what each detail holds.

2 takumi paint writes text unless the output ends in .json.

takumi upgrade

FlagEffect
-n, --dry-runPrints the cargo install command without running it.

Exit codes

CodeMeaning
0The output was written, or the listing printed.
1The render failed.
2The command line is wrong. 1
3The document tried to read a file outside the granted directories.

1 For example, an unknown flag or command, a value CSS does not accept, or an output format takumi does not write.

Limits

LimitValue
One file a document loads32 MiB
All files one render loads256 MiB
Files one render loads1024
Nested @import levels16

Last updated on