Skip to content

markuryy/open-fcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

open-fcm

TypeScript parser and encoder for Brother ScanNCut FCM/VCM files.

What's an FCM file?

FCM (and VCM) files are the native format for Brother ScanNCut cutting machines. They contain vector cut paths, thumbnails, and metadata. VCM files are specifically for print-and-cut workflows with registration marks.

Quick Start

import { readFcmFile, writeFcmFile } from "open-fcm";

// Parse an FCM file
const data = new Uint8Array(/* file bytes */);
const fcm = readFcmFile(data);

console.log(fcm.file_header.variant);  // "FCM" or "VCM"
console.log(fcm.cut_data.file_type);   // "Cut" or "PrintAndCut"
console.log(fcm.piece_table.pieces.length);

// Modify and re-encode
const output = writeFcmFile(fcm);

SVG Path Conversion

import { SvgPathParser, PathTool } from "open-fcm";

const parser = new SvgPathParser({ dpi: 72 });
const shapes = parser.parse("M 0,0 L 100,0 L 100,100 L 0,100 Z");

// Use shapes to build FCM paths
const path = {
  tool: PathTool.TOOL_CUT,
  shape: shapes[0],
  rhinestone_diameter: null,
  rhinestones: [],
};

Registration Marks (Print-and-Cut)

import { PageSizes, getFcmAlignmentMarks, generateRegistrationMarksSvg } from "open-fcm";

// Get mark positions for FCM alignment data
const marks = getFcmAlignmentMarks(PageSizes.LETTER);

// Generate SVG with registration marks for printing
const svg = generateRegistrationMarksSvg(PageSizes.LETTER);

Thumbnail Generation

import { generateThumbnail, generateBlankThumbnail } from "open-fcm";

// Generate thumbnail from paths (prevents machine reboots from invalid BMPs)
const thumbnail = generateThumbnail(paths);

// Or a blank white thumbnail
const blank = generateBlankThumbnail();

API Overview

Module Purpose
readFcmFile / writeFcmFile Parse and encode complete FCM files
SvgPathParser Convert SVG path d attributes to FCM format
generateThumbnail Create valid 88×88 monochrome BMP thumbnails
getFcmAlignmentMarks Registration mark positions for print-and-cut
generateRegistrationMarksSvg SVG output with Brother-compatible marks

Attribution

This is a TypeScript port inspired by the original Rust library:

  • fcmlib by justjanne — MPL 2.0 licensed, comprehensive FCM parser with examples
  • fcmlib fork — Adds SVG path parsing, registration marks, and a sticker sheet example for print-and-cut workflows

The original Rust implementation is more mature and battle-tested.

Disclaimer

"Brother" and "ScanNCut" are trademarks of Brother Industries, Ltd. This project is not affiliated with, endorsed by, or sponsored by Brother. The FCM/VCM file format was reverse-engineered for interoperability purposes.

See Also

  • Brother ScanNCut — The cutting machines that use FCM files
  • scripts/make-sticker-sheet.ts — Example script for generating print-and-cut files

About

TypeScript parser and encoder for Brother ScanNCut FCM/VCM files.

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages