PES / PEC — Brother
PES is the modern Brother format. PEC is the color block + thumbnail that live inside a PES (but can also stand on their own). The files have recognizable magic bytes; reading sniffs the content.
Features
- Stitch encoding: signed deltas in 0.1 mm units with scaling in the header.
- Colors: a sequence of indices into a table, Brother threads; the writer snaps the colors in your file to the closest Brother thread chart entry (
warn.COLOR_QUANTIZED). - Trims: supported as a byte command in the command stream.
- Hoop: the header stores known hoop dimensions.
Reading
packages/core/src/readers/pes.ts and pec.ts
detect the format via magic bytes
(isPec(), isPes() in
registry.ts:detectFormat). The PES header comes in many
different versions; the reader handles PES v1–v10+ through a single robust path.
Writing
src/writers/pes.ts + pec.ts produce a
self-contained PES with its PEC embedded. Colors: snapped to the Brother
chart. Standard note shown in the UI:
PES: colors are matched to the nearest Brother threads.