Skip to main content

PEC

Status

FieldValue
Extension(s).pec
Common ecosystemBrother / Baby Lock
Format familyMachine-specific stitch payload
Satin Studio statusAvailable now for import; backend detail for PES export
Open / importYes
ExportNo standalone export
ConfidenceHigh for the PEC payload shape Satin Studio imports/embeds.

What it is

PEC is an older Brother-family stitch payload. It carries the actual needle movement stream found inside many PES files, plus palette and preview/icon areas. See the PEC file structure for byte-level notes.

Satin Studio direction

Satin Studio parses PEC payloads, usually through PES import, and writes PEC as the embedded stitch stream inside exported PES.

Versions and variants

PEC appears both as standalone .pec files and as the embedded stitch payload inside PES files. Satin Studio supports the payload shape it currently parses for PES import/export, but standalone PEC compatibility and palette/icon variants need more fixtures.

File identification notes

Standalone PEC files may start with #PEC0001. Embedded payloads may be found through a PES offset or an embedded #PEC0001 marker. Compatible embedded payloads usually begin with an LA: label area followed by a 512-byte header, encoded stitches, and graphics bytes.

Observed structure notes

  • Standalone PEC may begin with #PEC0001; embedded PEC is commonly reached through a PES offset and begins at the LA: label area.
  • The label area includes LA:, a 16-byte label, spacing/unknown bytes, graphic stride/height, color-change count, color table bytes, a 24-bit little-endian stitch-block length/offset field, and then stitch bytes followed by graphics.
  • Observed stitch encoding uses seven-bit signed short movement unless a coordinate byte has 0x80 set. Long coordinates use 12-bit signed values; 0x10 marks jump and 0x20 marks trim in long-coordinate flags. 0xFE 0xB0 plus one following byte marks color change, and 0xFF 0x00 or end-of-data terminates in common streams.
  • Observed PEC writers make graphics icons 48 pixels wide by 38 pixels high, giving a six-byte stride per icon row.
  • Observed PEC headers write LA: plus an eight-character-truncated label padded to 16 bytes, twelve spaces, FF 00, icon stride, icon height, palette bytes, and space padding up to the stitch-block descriptor area.
  • Observed PEC stitch blocks begin with two zero bytes, a 24-bit little-endian block length placeholder, bytes 31 FF F0, width/height words, and two hoop-like constants 0x01E0 and 0x01B0 before encoded stitches.
  • Observed writers emit color changes as FE B0 02 and FE B0 01 alternately, then terminate stitch bytes with a single FF byte.

Structure sketch

PEC is the stitch payload Satin Studio already parses and embeds. The detailed byte map lives in PEC file structure.

struct PecPayload<'a> {
optional_signature: Option<[u8; 8]>, // b"#PEC0001" for standalone files
label_area: &'a [u8], // compatible payloads begin with b"LA:"
header_512: [u8; 512],
stitches: &'a [PecCommand],
graphics: &'a [u8],
}

enum PecCommand {
Stitch { dx: i16, dy: i16 },
Jump { dx: i16, dy: i16 },
Trim { dx: i16, dy: i16 },
ColorChange,
End, // 0xFF terminator in the stitch stream
}

What we still need

Standalone PEC machine expectations, palette variants, and useful preview/icon generation behavior.