Skip to content

sgidevnet/svg2fti

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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.

About

A small Python script to generate SGI IconSmith FTI icons from SVGs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages