Documentation
¶
Overview ¶
Package enginebin answers one question for the whole server: which of the heavy conversion programs - ffmpeg, ImageMagick, Ghostscript, poppler, rsvg - are installed here, and which binary each one is. It also names the office engine (Office), which is not a program here but the connected OnlyOffice Document Server, and its pre-0.50 name `libreoffice`.
Why there is exactly one answer ¶
Until v0.43.0 two probes asked it separately and disagreed. The About page (internal/capability) counted ImageMagick as present when `magick` OR `convert` was on PATH; the app runtime (internal/wasmplugin) additionally checked that `convert` really was ImageMagick. On Windows `convert` resolves to C:\Windows\System32\convert.exe — the FAT→NTFS volume converter — so the About page said "ImageMagick: OK" while Apps and the converter said it was not installed (release-candidate sweep, 2026-09-21). Every screen now reads Probe(), so the answer a person sees cannot depend on which page they are looking at.
The probe runs once per process. Installing an engine therefore takes a restart to show up — on every screen at once, which is the point: a live re-probe on one page and a boot-time answer on another is the disagreement this package exists to remove.
Index ¶
- Constants
- Variables
- func AliasesOf(id string) []string
- func Canonical(id string) string
- func DisplayName(id string) string
- func Known(id string) bool
- func MagickThumbArgs(src string, w, h int) []string
- func Names() []string
- func SetForTest(available map[string]string) func()
- type HEICStatus
- type Set
Constants ¶
const ( FFmpeg = "ffmpeg" ImageMagick = "imagemagick" Ghostscript = "ghostscript" Poppler = "poppler" RSVG = "rsvg" // Office is the office-document engine. It is not a program on this // machine: it is the OnlyOffice Document Server filex is connected to, // reached through its conversion API (internal/wasmplugin/office.go). // So it is never probed here, and it is there exactly while a document // server is configured. Office = officecmd.Engine // LibreOffice is the office engine's name until 0.50, kept as an ALIAS // of Office: an app that asks for `engines:libreoffice` is granted, told // about and run on the office engine, unchanged. Nothing named soffice is // looked for or run any more (0.50: LibreOffice left the images, and a // LibreOffice installed next to a bare binary is not used either - one // office engine, the same everywhere). LibreOffice = officecmd.LegacyEngine )
Engine ids. They are also the `engines:<id>` permission names a plugin asks for, so they never change spelling.
Variables ¶
var Candidates = map[string][]string{ FFmpeg: {"ffmpeg"}, ImageMagick: {"magick", "convert"}, Ghostscript: {"gs"}, Poppler: {"pdftoppm"}, RSVG: {"rsvg-convert"}, }
Candidates lists, per BINARY engine, the binaries that count as it, in order of preference. The office engine has none (see Office).
⚠ ImageMagick: `magick` FIRST. It is the ImageMagick 7 entry point and the only name that is ImageMagick on every platform; `convert` is the legacy ImageMagick 6 name and, on Windows, a system tool that happens to share it.
Functions ¶
func Canonical ¶ added in v0.50.0
Canonical is the engine an id names: the id itself, or the engine an alias stands for ("libreoffice" → "office").
func DisplayName ¶
DisplayName is an engine as a person reads it — the product's own spelling. The id stays the machine's word (permissions, logs). An alias reads as the engine it stands for: an app asking for `libreoffice` is asking for what this server converts office documents with.
func Known ¶ added in v0.50.0
Known reports whether id names an engine a plugin may ask for: a binary engine, the office engine, or an alias of one.
func MagickThumbArgs ¶ added in v0.50.0
MagickThumbArgs are the ImageMagick arguments that draw the primary image of src (`[0]`: the first of a burst or a sequence), upright (-auto-orient before -thumbnail, so the box fits the picture as it is shown), into a w x h box it is never enlarged to, as a PNG on stdout. thumb.generateHEIF runs them for every HEIC, HEIF and AVIF, and the HEIC probe runs the same ones: the probe measures the command the thumbnails use, not a cousin of it.
func Names ¶
func Names() []string
Names lists every engine id, sorted - the binary engines and the office engine, never an alias.
func SetForTest ¶
SetForTest replaces the process-wide answer (nil = probe again on next use) and returns a function that puts the previous one back.
Types ¶
type HEICStatus ¶ added in v0.50.0
type HEICStatus struct {
// Decodes: ImageMagick drew the sample, at its size and in its colour.
Decodes bool
// Detail says why not: ImageMagick's own words, or what came back instead
// of the picture. Empty when Decodes.
Detail string
}
HEICStatus is the probe's answer.
func HEIC ¶ added in v0.50.0
func HEIC() HEICStatus
HEIC is the server's one answer to "can a HEIC photo be drawn here", for the thumbnail pipeline, the capabilities and the boot log alike.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is one probe's answer: engine id → resolved binary.
func Probe ¶
func Probe() *Set
Probe is the server's one answer, computed on first use and kept for the life of the process.