ivy decodes, renders and encodes the file formats that a program shows as
images, in pure Go:
- Ebooks: EPUB, MOBI, AZW3, FictionBook, CHM, DjVu, comic book archives and the other formats that calibre reads.
- Office documents: Word, Excel and PowerPoint, OpenDocument, RTF and CSV.
- Page descriptions: PDF, XPS, PostScript, EPS, Adobe Illustrator, EMF and WMF.
- Images with layers: Photoshop, OpenRaster and Krita.
- Containers that carry an icon or a preview: Apple disk images, applications and packages for macOS, iOS, Android, Windows and Linux, and camera RAW files.
ivy also opens a file that a password protects, where the format has a public method of encryption.
A program that imports ivy needs the Go toolchain and nothing else. ivy does not use cgo and does not run an outside program. Each format is a package of its own, so a program links only the formats that it imports.
ivy draws each page with okage, and a program finds the type of a file with magic before it calls ivy. A rendering is good enough for a person to review the document. It is not an exact copy of the rendering of the program that made the document.
Phases 1 to 6 are done. These packages open a file and give its previews, its pages or both:
| Package | Formats |
|---|---|
github.com/xo/ivy/odf |
OpenDocument, with a password: the pages of the texts, the spreadsheets, the presentations and the drawings, and the thumbnail |
github.com/xo/ivy/docx |
Word, with a password: the pages, the thumbnail and the properties |
github.com/xo/ivy/xlsx |
Excel, with a password: every sheet on pages, as printing does, the thumbnail and the properties. The cells show the values that the file holds, and no formula is computed |
github.com/xo/ivy/pptx |
PowerPoint, with a password: one page for each slide that is not hidden, the thumbnail and the properties |
github.com/xo/ivy/rtf |
RTF: the pages, and the title, the author and the dates of \info |
github.com/xo/ivy/iwork |
Pages, Keynote and Numbers: the previews |
github.com/xo/ivy/ora |
OpenRaster and Krita: the image and the thumbnail |
github.com/xo/ivy/ps |
EPS: the TIFF and EPSI previews, and the title and the creator |
github.com/xo/ivy/camera |
The RAW files of cameras: the JPEG images, the camera and the date |
github.com/xo/ivy/comic |
CBZ and CBT: the pages and the cover |
github.com/xo/ivy/psd |
Photoshop: the image and the thumbnail |
github.com/xo/ivy/xps |
XPS and OpenXPS: the pages, the thumbnail, and the title and the authors |
github.com/xo/ivy/pdf |
PDF, with its password, and Illustrator compatible with PDF: the pages, the thumbnails, and the document information |
github.com/xo/ivy/epub |
EPUB 2, EPUB 3 and kepub: the pages, the cover, and the title and the authors |
github.com/xo/ivy/mobi |
MOBI, PRC, AZW, AZW3 and AZW4: the pages, the cover, and the title and the authors |
github.com/xo/ivy/fb2 |
FictionBook 2, also in a zip archive: the pages, the cover, and the title and the authors |
github.com/xo/ivy/chm |
Compiled HTML Help: the pages, the title and the language |
github.com/xo/ivy/html |
HTML and HTMLZ: the pages, the cover of an HTMLZ file, and the title |
github.com/xo/ivy/text |
Text and TXTZ: the pages, the cover of a TXTZ file, and the metadata of a TXTZ file |
github.com/xo/ivy/msdoc |
Word 97 to 2003, .doc and .dot, with a password: the pages, the thumbnail, and the title, the author and the dates |
github.com/xo/ivy/msxls |
Excel 97 to 2003 and Excel 5, .xls and .xlt, with a password: every sheet on pages, the thumbnail and the properties |
github.com/xo/ivy/msppt |
PowerPoint 97 to 2003, .ppt, .pps and .pot, with a password: one page for each slide, with its texts, the thumbnail and the properties |
github.com/xo/ivy/vsdx |
Visio, .vsdx and .vsd: the thumbnail and the properties |
github.com/xo/ivy/pub |
Publisher: the thumbnail and the properties |
github.com/xo/ivy/csv |
CSV, TSV and TAB: the rows as one table on pages |
github.com/xo/ivy/djvu |
DjVu, single and bundled: the pages, the thumbnails, and the title, the authors and the dates of the metadata |
github.com/xo/ivy/emf |
EMF, EMF+ and WMF, also compressed as EMZ and WMZ: the page, and the program and the title of an EMF file |
github.com/xo/ivy/markdown |
Markdown, with the extensions of GitHub: the pages and the title |
The other formats come in the phases of docs/PLAN.md.
f, err := os.Open("photo.psd")
if err != nil {
return err
}
defer f.Close()
fi, err := f.Stat()
if err != nil {
return err
}
doc, err := psd.Open(ctx, io.NewSectionReader(f, 0, fi.Size()))
if err != nil {
return err
}
defer doc.Close()
page, err := doc.Page(ctx, 0)
if err != nil {
return err
}
img, err := ivy.RenderImage(ctx, page, 72, color.White)A program that renders Office documents can import the module
github.com/xo/ivy/fonts and set ivy.Config{Fonts: fonts.FS()}. The module
holds Liberation Sans, Serif and Mono, Carlito and Caladea, which have the
metrics of Arial, Times New Roman, Courier New, Calibri and Cambria. Lines
and pages then break as they do in Office. It also holds Droid Sans
Fallback, under the Apache License 2.0, which draws the Chinese, Japanese and
Korean characters that a document does not embed. The module adds about
10.9 MB to a program.
A document that has no pages, such as an EPS file, gives its preview:
img, err := ivy.BestPreview(ctx, doc, image.Pt(512, 512))docs/FORMATS.md lists each format that ivy can support,
the way to support it, its source and its cost.
docs/PLAN.md gives the order.
| Document | What it holds |
|---|---|
| docs/PLAN.md | the plan, the architecture, the testing plan, the phases and the open questions |
| docs/API.md | the design of the public API and the expected layout of the packages |
| docs/FORMATS.md | the survey of the formats, with the estimates of three outside models |
| docs/BACKLOG.md | the work that is known and not done, and the work for okage, magic and iv |
| docs/UPSTREAM.md | the rules for code that ivy copies or ports |
| docs/decisions/ | every decision, one file each, with an index |
| CONTRIBUTING.md | how to change ivy |
| AGENTS.md | the rules for a coding agent, which also hold for a person |
ivy is one of the xo projects. Several of them port a library of C or
Rust to pure Go. Each one is a separate repository:
| Project | What it is |
|---|---|
| okage | A Go port of tiny-skia and resvg, which draws 2D graphics and SVG images. ivy draws with it |
| magic | A Go port of libmagic, which identifies the type of a file |
| transit | A Go port of tree-sitter, a parser of source code |
| rline | A readline package for Go, which reads a line of text that a person edits. It started as a port of isocline |
| zuzu | Draws DOT graphs, Mermaid diagrams, and Vega and Vega-Lite charts |
| ox | Parses the flags and arguments of a command line |
| usql | A command line client for SQL and NoSQL databases |
iv, an image viewer for the terminal, is the first program that uses ivy. ivy replaces the outside programs and the libraries that iv uses through cgo for ebooks, XPS, Office documents, PDF and HTML.
The code of ivy is under the MIT license, in LICENSE. A package that ivy
copies or ports from another project keeps the license of that project, in a
LICENSE file in its folder. psd/internal/oovpsd is a copy of
github.com/oov/psd, under the MIT license.