Skip to content

Repository files navigation

SWFSmelter

Convert images (PNG, JPEG, BMP, GIF, TIFF, WebP) into static SWF icon sprite files for Skyrim mod menus. Produces minimal, clean SWFs with ExportAssets that can be loaded via AttachMovie by Dynamic Inventory Icon Injector (DIII), Status Indicator Framework (SIF), or similar frameworks. Output is static icons only — no animation or ActionScript.

Features

  • Static icon sprites only — no animation, no ActionScript, just crisp bitmap icons
  • Minimal SWF output — no bloat, just DefineBitsLossless2, DefineShape2, DefineSprite, and ExportAssets
  • Multi-format input — PNG, JPEG, BMP, GIF, TIFF, WebP, and any format Pillow supports
  • Alpha transparency preserved — PNG, WebP, and GIF with alpha channels produce clean transparent icons; JPEG/BMP will have a white background
  • Per-image color tinting — assign a tint color to each icon; white (#ffffff) means no tint
  • Name overrides — rename export labels per image without renaming the source files
  • 7 registration points — top-left, top-center, top-right, center, bottom-left, bottom-center, bottom-right
  • Auto-resize — scale longest side to target pixels, keep aspect ratio
  • Batch processing — feed it a folder of images, get one SWF
  • CLI + GUI + .exe — command-line for scripting, tkinter GUI for point-and-click, standalone .exe for distribution
  • File reordering — drag-free ↑↓ buttons to arrange icon order before building
  • JSON config save/load — save and restore file lists, settings, names, and tint colors
  • SWF inspector — load existing SWFs to view icons, dimensions, and export individual images as PNG
  • Zero extra dependencies — only Pillow beyond Python stdlib

Requirements

Standalone .exe (Windows)

None. Download and run.

From source

  • Python 3.x
  • Pillowpip install Pillow

Installation

Standalone .exe (Windows)

Download SWFSmelter.exe from GitHub Releases. No Python needed.

From source

pip install Pillow

No build step, no compiler.

CLI Usage

# Basic: one icon
python SWFSmelter.py icon_smelt.png -o icons.swf

# Multiple icons
python SWFSmelter.py icon_smelt.png icon_temper.png icon_enchant.png -o icons.swf

# Resize to 128px, center registration
python SWFSmelter.py *.png -o icons.swf -r 128 --origin center

# Custom stage size and FPS
python SWFSmelter.py icon.png -o icons.swf -s 128 --fps 60

CLI Options

Flag Description Default
inputs One or more PNG files (required)
-o, --output Output SWF path icons.swf in first input's directory
-r, --resize Scale longest side to N px 64
-s, --stage Stage size in pixels 64
--fps Frame rate 30
--origin Registration point top-left

Registration Points

Origin Use Case
top-left DIII (Dynamic Inventory Icon Injector)
center SIF (Status Indicator Framework)
Others Custom layouts, menus, overlays

GUI Usage

python SWFSmelterGui.py

Tkinter GUI with two tabs:

Build SWF

  • Top bar — Load Config, Save Config, and + Add Images buttons
  • File list — thumbnails, filenames, per-image name override field, color tint picker, ✕ remove and ↑↓ reorder buttons
  • Output — output path with Browse button
  • Settings cards — two side-by-side panels:
    • Image Settings — Max Icon Size, Stage Size (px), Origin dropdown
    • Build SWF — large orange Build button
  • Log area — build output with per-icon dimensions, tint info, and file size

Inspect SWF

  • Load any SWF file to see its embedded icons
  • Shows stage size, FPS, icon names, dimensions, and character IDs
  • Export individual icons as PNG
  • Supports both ExportAssets sprite SWFs (SWFSmelter output) and frame-based animation SWFs (e.g. BOOBIES)

Inspector limitations:

  • ExportAssets SWFs — full support: displays and exports actual icon images
  • Frame-based SWFs — lists icon names and dimensions, but displays gray placeholder images since these use vector shapes rather than bitmaps. Exporting produces the placeholder, not the original artwork. A full SWF renderer would be needed to rasterize vector shapes.

How It Works

Each PNG becomes three SWF tags:

  1. DefineBitsLossless2 (tag 36) — RGBA bitmap, zlib-compressed
  2. DefineShape2 (tag 22) — clipped bitmap fill with configurable registration
  3. DefineSprite (tag 39) — places the shape, exportable by name

Export label = PNG filename without extension (e.g. icon_smelt.pngicon_smelt).

SWF Structure

FWS header (uncompressed, SWF8)
├── FileAttributes
├── SetBackgroundColor (white)
├── [per icon:]
│   ├── DefineBitsLossless2  (character ID N)
│   ├── DefineShape2         (character ID N+1)
│   ├── DefineSprite         (character ID N+2)
│   └── ExportAssets         (label = filename stem)
├── ShowFrame
└── End

Tested Frameworks

Output SWFs have been tested and confirmed working with:

Other frameworks that use AttachMovie with SWF ExportAssets should work but are untested.

Integration Examples

Dynamic Inventory Icon Injector (DIII)

{
  "icon": "smithyInfoIcons.swf",
  "label": "icon_smelt",
  "condition": "smithySmelt"
}

Status Indicator Framework (SIF)

; AttachMovie call using the SWF and export label
menu.AttachMovie("icons.swf", "icon_smelt", depth)

Building from Source

No compilation needed. Just run the Python scripts.

Standalone .exe (Windows)

For distribution as a single .exe that runs without Python installed:

pip install pyinstaller
pyinstaller --onefile --noconsole --icon=SWFSmelterIcon.ico --add-data "SWFSmelterIcon.png;." --name=SWFSmelter SWFSmelterGui.py

Output: dist/SWFSmelter.exe (~30 MB, includes Python + Pillow + tkinter).

The --add-data flag bundles the window icon PNG so it appears at runtime without needing external files.

To rebuild the .ico from the PNG source:

from PIL import Image
img = Image.open("SWFSmelterIcon.png")
img.save("SWFSmelterIcon.ico", sizes=[(256,256),(128,128),(64,64),(48,48),(32,32),(16,16)])

License

MIT

Credits

  • SWF format specification — Adobe/Macromedia
  • Original SIF builder inspiration — SkyUI ItemFactory community
  • SWF bug fixes — byte-by-byte comparison against working reference

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages