1.0.8 • Published 11 months ago

sff-extractor v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months 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

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago