1.0.8 • Published 1 year ago

sff-extractor v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

SFF Extractor

Extract information and images contained in a SFF file (Elecbyte format).

Options

OptionDescriptionTypeDefault value
palettesIncludes palettesBooleantrue
paletteBufferIncludes buffer of each paletteBooleantrue
paletteTableIncludes colors table of each paletteBooleantrue
spritesIncludes spritesBooleantrue
spriteBufferIncludes buffer of each spriteBooleantrue
decodeSpriteBufferDecode buffer of each spriteBooleanfalse
spriteGroupsFilter sprites by groupsArray[]
applyPaletteApply the palette when decoding sprite bufferBuffernull

Examples

Extract everything:

import { readFileSync } from "node:fs";
import extract from "sff-extractor";

const buffer = readFileSync("kfm.sff");
const data = extract(buffer);

console.log(data);

Extract only global metadata:

const options = {
  sprites: false,
  palettes: false,
};
const data = extract(buffer, options);

Extract a specific sprite group and decode the image:

const options = {
  palettes: false,
  spriteBuffer: false,
  decodeSpriteBuffer: true,
  spriteGroups: [6053],
};
const data = extract(buffer, options);
const sprite = data.sprites[0];
const image = convertToImage(
  sprite.decodedBuffer, // 1 pixel = 4 bytes (RGBA)
  sprite.width,
  sprite.height,
);

Apply an external palette:

const buffer = readFileSync(`kfm.sff`);
const palette = readFileSync(`palette.act`);
const options = {
  palettes: false,
  spriteBuffer: false,
  decodeSpriteBuffer: true,
  spriteGroups: [0],
  applyePalette: palette,
};
const data = extract(buffer, options);
const sprite = data.sprites[0];
const image = convertToImage(sprite.decodedBuffer, sprite.width, sprite.height);
1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago