Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.81 KB

README.md

File metadata and controls

56 lines (36 loc) · 1.81 KB

svg2fti

A very-much-so-held-together-by-tape helper for converting SVGs to SGI FTI vector format.

python3 -m pip install -r requirements.txt

usage: svg2fti.py [-h] --svg SVG [--out OUT] [--num_samples NUM_SAMPLES] [--color_map COLOR_MAP]
svg2fti.py: error: the following arguments are required: --svg

Example

python3 svg2fti.py --svg nedit.svg

Input SVG on left.

Output FTI on right as visualized by Aqua Phoenix FTI Editor

Notes

Geometry

  • Polygon vs line: if a fill color value cannot be resolved, bgnline() is used
  • Scale: FTI coords are 100x100,
  • Curves: SVG paths mapped to lists of vertices, increasing num_samples will make smoother

Color attributes

Colors parsed with tinycss2.color3 from:

  • stroke

  • fill

  • style

  • Gradients are ignored

  • Try to follow url(#id): the first (via xpath query) color attribute is chosen

Palette

  • Valid values are 0 -> 15, -16 -> -255
    • 0 -> 15 are a basic color table
    • -16 -> -255 are other colors that are interpolated combinations of colors 0 -> 15
  • color_map.json contains a mapping of FTI color palette index to RGB values
  • Only palette colors available, color with smallest delta to input chosen

Credits

Everything else (c) David Stancu 2021 and contributors.