Print this guide
Table of Contents
- 1 Overview
- 2 Installation
- 3 Installation Troubleshooting
- 4 GUI Tour
- 5 GUI Guide
- 6 Video Processing
- 7 Technical Details
- Architecture overview
- Widget hierarchy
- Key components
- Thread safety
- CustomTkinter theming
- CTkRangeSlider custom widget
- Drag-and-drop implementation
- Video processing pipeline
- UI state transitions
- Responsive layout
- State management
- Window lifecycle
- Key method architecture
- File extension constants
- Dependencies
- 8 API Reference
- App
- Processing
- Video
- Widgets
- Utility functions
- extract_preview_from_lines(filepath: str) -> Image.Image | None
- extract_frame(video_path: str, frame_number: int) -> Image.Image | None
- fit_image_to_box(image: Image.Image, width: int, height: int) -> Image.Image
- truncate_start(text: str, max_chars: int = 20) -> str
- truncate_middle(text: str, max_width: int) -> str
- create_placeholder_image(width: int, height: int, text: str) -> Image.Image
- 9 Examples
- Launch the app
- Batch convert .lines files to SVG
- Apply a halftone style to 50 product photos
- Re-export .lines files with a different style
- Style interpolation across a sequence
- Create a 30-second styled video from MP4
- Process video with frame range selection
- Use style interpolation for an animated video
- Drag-and-drop workflow
- Probe video metadata from Python
- Use the range slider widget standalone
- Run the processing pipeline from a script
- Extract .lines previews from a script
- Process video with style objects from Python
- 10 Changelog
- 11 Style Guide
- 12 Topics
Vexy Lines for Mac & Windows | Download | Buy | Batch GUI | CLI/MCP | API | .lines format
vexy-lines-run¶
Drop images in. Pick a style. Get vector art out.

vexy-lines-run is a desktop batch GUI for Vexy Lines style transfer. Feed it images, .lines documents, or video. Choose an artistic style. Export as SVG, PNG, JPG, or MP4. Built on CustomTkinter, it runs on macOS, Windows, and Linux.
Running Vexy Lines Run¶
macOS¶
Open Terminal, paste, press Enter:
curl -LsSf https://astral.sh/uv/install.sh | sh && "$HOME/.local/bin/uvx" --python 3.12 vexy-lines-run@latest
Windows¶
Open Command Prompt, paste, press Enter:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex; $env:Path = \"$HOME\.local\bin;$HOME\AppData\Roaming\uv;$env:Path\"; uvx --python 3.12 vexy-lines-run@latest"
From Python¶
from vexy_lines_run import launch
launch()
Three tabs, one workflow¶
| Tab | Input | What happens |
|---|---|---|
| Lines | .lines files |
Extract embedded previews as PNG/JPG, copy files as LINES |
| Images | PNG, JPG, WEBP, BMP, TIFF, GIF | Apply vector fill patterns through the MCP engine |
| Video | MP4, MOV, MKV, AVI, WEBM | Style transfer frame-by-frame with optional audio passthrough |
Pick a primary style from any .lines file. Optionally pick an end style: the app interpolates between the two across the input sequence.
What you get¶
- Style picker with live thumbnail previews
- Style interpolation: blend two styles across a batch or video
- AI Rename Layers & Fills: describe each fill with a vision model and rewrite generic captions
- Drag-and-drop onto any panel
- Background export with live progress on the Export button
- Output formats: SVG, PNG, JPG (1x-4x upscale), MP4, LINES
- Native menu bar with full keyboard-equivalent access
- Dark mode via CustomTkinter
Documentation¶
- Installation: quick start, platform notes, dependencies, dev setup
- GUI Guide: what every button does, with screenshots and troubleshooting
- GUI Technical Documentation: architecture, widget tree, threading, implementation details
- Examples: real workflows step by step, plus scripting recipes
- API Reference: Python API for App, processing, video, and widgets
- Changelog: release history
Installation¶
What you need¶
- Python 3.11+ (3.12 recommended)
- Tk/Tcl: ships with most Python installs. On Linux, install
python3-tkfrom your package manager. - Vexy Lines desktop app: the style engine runs as an MCP server inside the app on
localhost:47384. Without it, the GUI launches but can only extract previews from.linesfiles and copy.linesfiles. Anything involving style transfer requires the app running.
Quick start¶
macOS¶
Open Terminal, paste, press Enter:
curl -LsSf https://astral.sh/uv/install.sh | sh && "$HOME/.local/bin/uvx" --python 3.12 vexy-lines-run@latest
Windows¶
Open Command Prompt, paste, press Enter:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex; $env:Path = \"$HOME\.local\bin;$HOME\AppData\Roaming\uv;$env:Path\"; uvx --python 3.12 vexy-lines-run@latest"
These one-liners install uv (a fast Python package manager) and run vexy-lines-run in an isolated environment. Nothing is permanently installed on your system. uvx manages it.
Install with pip¶
pip install vexy-lines-run
With uv (faster):
uv add vexy-lines-run
What's included¶
The base install includes all functionality (video processing, drag-and-drop, and native menus). No optional extras or feature flags needed.
Runtime dependencies¶
These install automatically with the package:
| Package | Purpose |
|---|---|
vexy-lines-apy |
MCP client and style engine bindings |
vexy-lines-py |
.lines file parser (transitive, via vexy-lines-apy) |
customtkinter |
Modern Tk widgets with dark mode |
CTkMenuBarPlus |
Enhanced menu bar with cascading dropdown menus |
Pillow |
Image loading, thumbnails, format conversion |
loguru |
Debug logging (not shown to users) |
tkinterdnd2 |
Drag-and-drop file support |
opencv-python-headless |
Video frame reading and writing |
svglab or resvg-py |
SVG-to-raster conversion for video/image export |
System dependencies for video¶
Video processing also depends on system binaries (not Python packages):
| Binary | Required for | How to install |
|---|---|---|
ffmpeg |
Audio merging in MP4 exports | brew install ffmpeg (macOS), apt install ffmpeg (Debian/Ubuntu), ffmpeg.org (Windows) |
ffprobe |
Audio stream detection | Ships with ffmpeg |
Without ffmpeg, video export still works, but without audio passthrough.
Launch¶
Three ways:
# Installed console script
vexy-lines-run
# Module entry point
python -m vexy_lines_run
# From Python
from vexy_lines_run import launch
launch()
All three do the same thing: create an App instance in dark mode and call mainloop().
Verify¶
From Python:
from vexy_lines_run import App
print("vexy-lines-run is ready")
Platform notes¶
macOS¶
Works out of the box. Tk ships with the Python.org and Homebrew installers.
Windows¶
Works out of the box. Tk ships with the python.org installer.
Linux¶
Tk might not be bundled with your system Python. Install it:
# Debian/Ubuntu
sudo apt install python3-tk
# Fedora
sudo dnf install python3-tkinter
# Arch
sudo pacman -S tk
Drag-and-drop depends on the Tcl/Tk DnD extension. On some minimal Linux installs, the underlying tkdnd library may be missing even if tkinterdnd2 is installed. The app works without it: you use the buttons and menus instead.
Development install¶
git clone https://github.com/vexyart/vexy-lines.git
cd vexy-lines/vexy-lines-run
uv venv --python 3.12
uv pip install -e ".[dev]"
Run tests:
uvx hatch test
The test suite mocks the MCP client and macOS APIs, so tests run on any platform without the Vexy Lines app.
Installation Troubleshooting¶
Platform-specific issues and fixes for vexy-lines-run.
Windows¶
tkinterdnd2 — drag-and-drop not working¶
tkinterdnd2 ships a pre-built tkdnd Tcl extension inside the wheel. On
Windows, the DLL must be on a path that Tcl can find.
Symptom: The app launches but dropping files onto the window does nothing,
or the title bar shows tkdnd unavailable.
Fix 1: reinstall with uv or pip:
pip uninstall tkinterdnd2 -y
pip install tkinterdnd2
If you used a conda environment, make sure you installed tkinterdnd2 from
PyPI, not from conda-forge (the conda package bundles a different Tcl layout).
Fix 2: run as a module rather than a script:
Calling python -m vexy_lines_run instead of vexy-lines-run ensures that
the tkinterdnd2 package root is on sys.path before tkinter initialises.
Fix 3: Tcl/Tk version mismatch:
The bundled tkdnd DLL targets a specific Tcl version. If your Python ships
with Tcl 8.6 but tkinterdnd2 was built for Tcl 9, the extension cannot load.
Check your Tcl version:
import tkinter
print(tkinter.TclVersion)
Then check the tkinterdnd2 wheel name on PyPI: it encodes the Tcl target.
Install the matching version or upgrade Python to one that ships Tcl 9.
Workaround: The app works without drag-and-drop. Use the + buttons or the menu bar to add files.
"No module named '_tkinter'" on Windows¶
This means Tk was not included in your Python installation.
Fix: Download and reinstall Python from python.org. During setup, make sure tcl/tk and IDLE is checked under Optional Features.
The app window appears behind other windows¶
CustomTkinter calls wm_attributes("-topmost", True) briefly on startup to
bring the window to the front, then drops it back to normal z-order. If the
window still appears behind, click the taskbar icon.
macOS¶
"Python framework" warning with CustomTkinter¶
On some macOS Python installs (especially pyenv or Homebrew Python), Tkinter
may fail with:
This program needs access to the screen. Please run with a Framework build
of python, and only when you are logged in on the main display of your Mac.
Fix: Use the python.org installer or the Homebrew cask
(brew install --cask python), which ships a proper macOS Framework build.
Drag-and-drop works but paths contain spaces¶
tkinterdnd2 wraps paths with spaces in braces: {/path/to/my file.png}.
The app handles this automatically via the _parse_drop_data method.
Linux¶
Tk not available — "No module named '_tkinter'"¶
Most Linux distributions do not bundle Tk with the system Python.
# Debian / Ubuntu
sudo apt install python3-tk
# Fedora / RHEL
sudo dnf install python3-tkinter
# Arch
sudo pacman -S tk
Drag-and-drop not working¶
The underlying tkdnd Tcl extension may be missing on minimal installations
even when tkinterdnd2 is installed.
# Debian / Ubuntu — install the system tkdnd package
sudo apt install tk-dnd
# Then reinstall tkinterdnd2 so it finds the system library
pip install --force-reinstall tkinterdnd2
If tk-dnd is unavailable for your distribution, the app still works using
the + buttons and menu bar. Drag-and-drop is a convenience, not a
requirement.
Running headless (no display server)¶
The GUI requires a display. For CI or server environments, use Xvfb:
sudo apt install xvfb python3-tk
xvfb-run python -m vexy_lines_run
The test suite itself does not require a display: all GUI tests use mocks.
Only tests/test_smoke_headless.py tries to open a real Tk window and will
skip automatically if $DISPLAY is not set.
Video processing¶
ffmpeg not found¶
Audio passthrough requires ffmpeg on your PATH. Without it, the audio
toggle is hidden and video exports are video-only.
# macOS
brew install ffmpeg
# Debian / Ubuntu
sudo apt install ffmpeg
# Windows — download from https://ffmpeg.org/download.html and add to PATH
OpenCV fails to open a video file¶
Some container formats require additional codec support. Try:
pip install opencv-python-headless --upgrade
If OpenCV still cannot open the file, convert it first with ffmpeg:
ffmpeg -i input.webm -c:v libx264 output.mp4
"No module named 'cv2'"¶
OpenCV is pulled in transitively by vexy-lines-apy. If it is missing from
your environment, install it explicitly:
pip install opencv-python-headless
# or, with the video extra:
pip install "vexy-lines-run[video]"
General¶
Import error: customtkinter not found¶
pip install customtkinter
The app launches but style transfer does nothing¶
Style transfer requires the Vexy Lines desktop app running on your machine.
The GUI connects to it via a local MCP server on localhost:47384.
- Launch the Vexy Lines app.
- Wait a few seconds for its MCP server to start.
- Try exporting again.
Check the log output (--log-level DEBUG is not a flag; use the
loguru environment variable LOGURU_LEVEL=DEBUG python -m vexy_lines_run)
for connection errors.
"MCP error: Connection refused"¶
Same as above: the Vexy Lines app is not running or has not finished starting.
Reinstalling from scratch¶
pip uninstall vexy-lines-run vexy-lines-apy vexy-lines-py -y
pip install vexy-lines-run
With uv:
uv pip uninstall vexy-lines-run vexy-lines-apy vexy-lines-py
uv pip install vexy-lines-run
GUI Tour¶
A quick walkthrough of the three input tabs and the shared controls.
Window layout at a glance¶
+--------------------------------------+-----------------+
| Tab: Lines | Images | Video | Style |
| | End Style |
| [input list / controls] [preview] | [preview] |
+--------------------------------------+-----------------+
| Export as [Format ▾] [Size ▾] ♪ ○ [Export ▶] |
+-----------------------------------------------------------+
The left panel (roughly two-thirds) holds the active tab. The right panel holds the style picker. The bottom strip is always visible regardless of which tab is active.
Tab 1 — Lines¶
Purpose: batch-export .lines documents as SVG, PNG, JPG, or plain copies.
What you see:
- Left half: scrollable file list. Click a name to select it (blue highlight).
- Right half: preview image extracted from the selected file's embedded data.
- Buttons below the list: + add files, − remove selected, ✕ clear all.
What to try:
- Click + (or drag
.linesfiles onto the list). - Select a file. The preview updates immediately.
- Choose LINES in the format dropdown and click Export ▶ to copy files without touching the MCP API.
- Choose PNG or JPG to extract the embedded preview image from each file.
When the Lines tab is active the Style panel on the right is hidden: .lines
files carry their own fill structure and do not accept an external style.
Tab 2 — Images¶
Purpose: apply a Vexy Lines fill style to raster images and export SVG or PNG/JPG.
What you see:
- Left half: scrollable image list with thumbnails.
- Right half: larger preview of the selected image.
- Buttons below the list: same + / − / ✕ as the Lines tab.
What to try:
- Load a
.linesstyle in the Style panel on the right. - Click + (or drag PNG/JPG/WEBP files onto the list).
- Select an image. The preview updates.
- Click Export ▶. The app opens each image in Vexy Lines via MCP and replicates the style's fill tree onto it. The engine renders, and the app saves the SVG or raster.
A style must be loaded for image export. If you export without one, the app reports "A style file is required."
Tab 3 — Video¶
Purpose: per-frame style transfer on video clips, with optional audio passthrough.
What you see:
- Two preview panes side by side: first and last frames of the selected range.
- Range slider with two draggable handles below the previews.
- Start / End entry fields: type exact frame numbers (1-indexed).
- Frame count label: shows how many frames are in the selected range.
- Buttons: + add a video, ✕ remove it, path label shows the file.
What to try:
- Click + to load a video (MP4, MOV, MKV, AVI, WEBM).
- Drag the range slider handles to pick a short segment for a test run (5–10 frames).
- Load a style.
- Choose MP4 in the format dropdown and click Export ▶.
The range slider and text entries stay in sync. Previews update whenever the range changes and show the actual first and last frames extracted via OpenCV.
Style picker (right panel)¶
Two sub-tabs: Style and End Style.
- Click + to pick a
.linesfile. A thumbnail appears immediately. - Click ✕ to clear.
- Loading an End Style enables interpolation: the first input gets 100% start style, the last gets 100% end style, and the items in between get a proportional blend.
Export controls (bottom strip)¶
| Control | Options | Notes |
|---|---|---|
| Format | SVG, PNG, JPG, MP4, LINES | Not every format works on every tab |
| Size | 1×, 2×, 3×, 4× | Disabled for SVG and LINES |
| ♪ toggle | on / off | Audio passthrough: visible only when conditions are met |
| Export ▶ | — | Starts export on a background thread; shows progress |
During export the button label changes to a percentage and status message. Click Stop ■ to abort.
Next steps¶
- Full GUI Guide: every control, every error message, every edge case.
- Video Processing: the frame pipeline in detail.
- Installation Troubleshooting: platform gotchas.
GUI Guide¶
Three tabs on the left. Style picker on the right. Export controls at the bottom. That's the whole app.

Layout¶
+--------------------------------------+-----------------+
| | |
| Tab: Lines | Images | Video | Style |
| | End Style |
| [file list] [preview] | [preview] |
| | |
+--------------------------------------+-----------------+
| Export as [Format ▾] [Size ▾] ♪ ○ [Export ▶] |
+-----------------------------------------------------------+
The left panel takes roughly two-thirds of the window. The right panel holds your style. The bottom strip handles export.
The window title reads "Style with Vexy Lines". Default size is 900x700, minimum 960x480. Resize freely: previews, file lists, and path labels adapt automatically.
Menu bar¶
Six menus sit at the top: File, Lines, Image, Video, Style, Export.
| Menu | Key items |
|---|---|
| File | Add Lines, Export, Quit |
| Lines | Add, Remove Selected, Remove All Lines, AI Rename Layers & Fills…, AI Rename Settings… |
| Image | Add Images, Remove Selected, Remove All Images |
| Video | Add Video, Reset Range, Remove Video |
| Style | Open Style, Open End Style, Reset Styles |
| Export | Export, Location, Format submenu, Size submenu, Audio submenu |
The menu bar mirrors the buttons in the GUI, so you can use menus or buttons interchangeably.
Lines tab¶
Load .lines files, the native Vexy Lines document format.

The left half is a scrollable file list. Click a filename to select it (highlights in blue). The right half shows a preview image extracted from the selected file's embedded data.
Buttons along the bottom:
| Button | What it does |
|---|---|
| + | Opens a file dialog filtered to *.lines |
| − | Removes the selected file from the list |
| ✕ | Clears the entire list |
What happens on export:
| Condition | Behavior |
|---|---|
| Format = LINES | Plain file copy: no MCP, no rendering |
| Format = PNG or JPG | Extracts the embedded preview image from each file |
| Format = SVG | Not supported in Lines mode. Use Images mode with a style instead |
When no files are loaded, the list area shows a dark placeholder.
AI Rename Layers & Fills¶
.lines documents often carry generic captions such as Layer, Layer 2, Blended, Linear. Lines ▸ AI Rename Layers & Fills… (under the Lines menu, after Remove All Lines) renames them to describe what each fill actually draws (e.g. car-on-road, top-sky-bridge), then names each layer from the fills it contains. Only the captions change; the artwork is untouched.
Add at least one .lines file in the Lines tab first. The command operates on the selected file (or the first in the list if none is selected).
The flow:
- A confirmation dialog explains that it will render each of the N fills one by one in Vexy Lines, ask a vision model to describe each, and write a renamed copy, and that it needs the Vexy Lines app plus an LLM endpoint and can take a while.
- After you confirm, a Save dialog asks where to write the renamed
.lines(defaults to<stem>-renamed.linesbeside the input). - The work runs on a background thread. Progress shows in the window title bar (e.g. "Vexy Lines Run — Describing fill 3/53").
- On success, a dialog reports how many fills and layers were renamed, and the saved file is revealed in your file manager.
- On error, an error dialog explains what went wrong.
Configuring the model: Lines ▸ AI Rename Settings…
The endpoint is an OpenAI-compatible /v1 server. Open Lines ▸ AI Rename Settings… to set, in a dialog:
- API URL: the
/v1base URL - API key
- Vision model: used to describe each fill
- Text model: used to name each layer
Settings are saved to ~/.config/vexy-lines-run/settings.json. Any field left blank falls back to its environment variable: VEXY_LINES_LLM_API_URL, VEXY_LINES_LLM_API_KEY, VEXY_LINES_LLM_MODEL_VISION (vision), and VEXY_LINES_VLM_MODEL (text).
Requirements:
- The
[ai]extra:pip install "vexy-lines-run[ai]". - The Vexy Lines desktop app running (renders each fill via MCP).
- An OpenAI-compatible
/v1LLM endpoint, configured via the settings dialog or theVEXY_LINES_*environment variables above.
Artifacts: the inspection images and a rename-plan.json are written to a <stem>-rename/ folder beside the input.
See the full guide: AI-assisted rename of layers & fills. Background on the document model: Document Structure.
Images tab¶
Load raster images and turn them into vector art.

Supported formats: PNG, JPG, JPEG, GIF, BMP, TIFF, WEBP, or anything else Pillow can open.
A style must be selected for image export. Without one, there's nothing to apply. The app opens each image as a new document in Vexy Lines through the MCP API and replicates the style's fill tree onto it. The engine renders, and the app exports the result.
The screenshot above shows eight bear photos loaded with a halftone cat style (kitty.lines) ready to apply. The preview shows the currently selected photo; the style panel shows what the fill pattern looks like.
Buttons: Same as the Lines tab: + (add images), − (remove selected), ✕ (clear all).
If style application fails for a particular image (MCP timeout, connection error), the app logs a warning and continues to the next file rather than aborting the entire batch.
Video tab¶
Process video frame-by-frame with style transfer.

Supported video formats: MP4, MOV, MKV, AVI, WEBM.
Two preview panes sit side by side: the first and last frames of your selected range. Below them:
| Control | What it does |
|---|---|
| Start entry | Type an exact start frame number (1-indexed) |
| Range slider | Drag the two handles to set start and end frames |
| Frame count | Shows how many frames are in the selected range (e.g. "5 frames") |
| End entry | Type an exact end frame number |
| + | Opens a file dialog for video files |
| Path label | Shows the loaded video's path (truncated to fit) |
| ✕ | Removes the loaded video |
The range slider and text entries stay in sync: change one, the other updates. Press Enter or click away from a text entry to apply the value. Values are clamped to valid bounds (1 to total frames). The previews update when the range changes, extracting the actual frames via OpenCV.
Video processing workflow¶
The video pipeline works like this:
- Load: Open a video file. The app probes it with OpenCV to get resolution, frame rate, frame count, and audio presence.
- Select range: Use the slider or entry fields to pick which frames to process. The previews update to show the first and last frames of your selection.
- Choose a style: Load a
.linesfile in the Style panel. The style's fill structure will be applied to every frame. - Pick output format:
- MP4: re-encodes the styled frames back into a video file
- PNG or JPG: saves each styled frame as a separate image file (
frame_000001.png, etc.) - Export: The app extracts each frame, saves it as a temporary PNG, sends it to the Vexy Lines engine via MCP for style transfer, rasterises the resulting SVG, and writes the output. For MP4, frames go through OpenCV's VideoWriter. For individual images, each frame is saved directly.
Audio passthrough¶
The audio toggle (♪ switch) appears only when all five conditions are met:
- A video with an audio track is loaded
- Export format is MP4
- The full frame range is selected (first frame to last)
- You're on the Video tab
- The video actually has an audio stream (detected via ffprobe)
Why the full-range restriction? Re-encoding a frame subset with the original audio would produce mismatched timing. For partial ranges, the audio is silently dropped.
When audio passthrough is enabled, the app writes the styled video first, then merges the original audio track using ffmpeg (-c:v copy -c:a aac). This requires ffmpeg to be installed and on your PATH.
Style picker¶
The right panel has two tabs: Style and End Style.
Click + to choose a .lines file. A thumbnail preview extracted from the file appears immediately. The file path displays below, truncated from the left with "…" if it's too long for the panel width.
Click ✕ to clear the style and return to the placeholder.
How styles work¶
A .lines file contains a tree of groups, layers, and fills. Each fill is an algorithm (linear, halftone, scribble, spiral, etc.) with numeric parameters. When you apply a style, the app extracts that fill structure and replicates it onto your input image through the MCP API. The Vexy Lines engine then renders each fill algorithm against the image's pixel data, producing an SVG.
For raster output (PNG, JPG, MP4 frames), the SVG is then rasterised using svglab or resvg-py.
End style and interpolation¶
Select a second .lines file in the End Style tab to enable style interpolation across a batch:
| Position in sequence | Style blend |
|---|---|
| First input | 100% primary style |
| Middle inputs | Proportional blend |
| Last input | 100% end style |
The blend factor t for item i of N total items is i / (N - 1). Both styles must be structurally compatible: same number of groups, layers, and fills, with matching fill types. If they don't match, the export will report an error ("Start and end styles have incompatible structures").
This is useful for animated sequences: load 100 frames, set a "clean lines" start style and a "chaotic scribble" end style, and watch the artwork gradually transform.
Style panel and the Lines tab¶
When the Lines tab is active, the style panel is disabled (grayed out). Lines files carry their own fill structure, so the app disables the style picker to avoid confusion. Switch to Images or Video to enable the style picker.
Export controls¶
The bottom strip of the window:
Export as [SVG ▾] [— ▾] ♪ ○ [Export ▶]
Format¶
| Format | Notes |
|---|---|
| SVG | Vector output: no size scaling needed |
| PNG | Raster, supports 1x–4x upscale |
| JPG | Raster, supports 1x–4x upscale |
| MP4 | Re-encoded video with styled frames (use with Video tab) |
| LINES | Direct file copy, no processing (use with Lines tab) |
The format dropdown always shows all five options. Not every format makes sense on every tab. For example, MP4 only works with video input and LINES only works with .lines input. If you pick an unsupported combination, the export will tell you.
Size¶
Choose output scaling: 1x, 2x, 3x, or 4x. The multiplier applies to raster and video exports. For 2x, a 1000x800 source produces a 2000x1600 output using Lanczos resampling.
Disabled (shows "—") for SVG and LINES formats: vector output has no fixed resolution, and LINES is a file copy.
Export button¶
Click Export ▶ to start. A dialog appears:
- MP4 format: Save-file dialog. Choose a filename and location
- All other formats: Folder dialog. Choose a directory; the app names files automatically after the input filenames
During export, the button text changes to show progress as a percentage and status message (e.g. "35% Styling bear_03..."). The button is disabled while the export runs. On completion, the button returns to Export ▶ and re-enables.
On error, a dialog pops up with the error message.
Error handling during export¶
If an export fails, a dialog pops up with the error message. Common causes:
- "MCP error ... Make sure Vexy Lines is running.": The Vexy Lines app isn't running, or the MCP server on port 47384 isn't responding. Launch Vexy Lines first.
- "A style file is required": You're on the Images or Video tab without a style selected. Load a
.linesfile in the Style panel. - "Start and end styles have incompatible structures": Your primary and end styles have different fill tree layouts. They must have matching numbers of groups, layers, and fills with identical fill types.
- "Failed to read style": The style
.linesfile was deleted, moved, or is corrupted since you loaded it. - "No input files selected": You clicked Export without adding any files.
- "SVG export from .lines files requires the Vexy Lines app (MCP)": SVG export isn't available in Lines mode. Use Images mode with a style instead, or choose PNG/JPG/LINES format.
For batch exports (multiple images), a single file failure logs a warning and continues. The export doesn't abort over one bad file.
Drag-and-drop¶
Drop files directly onto the app:
| Drop target | Accepts |
|---|---|
| Lines file list or preview | .lines files |
| Images file list or preview | Image files (PNG, JPG, etc.) |
| Video preview areas or path label | Video files |
| Style preview or path label | .lines files (loads as style) |
| End Style preview or path label | .lines files (loads as end style) |
The app filters by extension based on the drop target. Drop a PNG on the Lines list and nothing happens: no error, no action.
Paths with spaces or special characters work correctly. The app handles both brace-enclosed ({/path/to/my file.png}) and space-separated drop data from tkinterdnd2.
The app silently ignores duplicate files: drop the same image twice and it appears only once in the list.
Drag-and-drop requires tkinterdnd2, which is included in the base install. If it's missing (e.g. on some Linux minimal installs), the app still works; you use the file dialogs and menus instead.
Appearance¶
The launch() function sets CustomTkinter to dark mode. The app uses a dark slate background. Selected files highlight in blue. The Export button uses a red theme (#D32F2F background, #B71C1C on hover).
Preview images maintain their aspect ratio: a tall narrow image scales to fit within the preview box without stretching. When no image is loaded, the area shows a dark grey placeholder.
Path labels truncate from the left: a path like /Users/adam/Documents/projects/art/kitty.lines becomes …projects/art/kitty.lines to fit the available width. Labels re-truncate when you resize the window.
Troubleshooting¶
The app launches but export does nothing¶
Make sure the Vexy Lines desktop app is running. The GUI connects to it via MCP (a JSON-RPC server on localhost:47384). Without the app, no style transfer can happen. Only LINES file copy works without it.
"MCP error: Connection refused"¶
The Vexy Lines app isn't running, or its MCP server hasn't started yet. Launch Vexy Lines and wait a few seconds for it to fully load before trying to export.
Export is very slow¶
Each frame or image requires a round-trip to the Vexy Lines engine: load image, apply fills, render, export SVG, then rasterise. For video, this happens per frame. A 5-second video at 30fps means 150 round-trips. Tips:
- Use a shorter frame range for testing (narrow the slider to 5-10 frames first)
- Use 1x size, because larger multipliers increase rasterisation time
- Lower DPI in the Vexy Lines app settings reduces render time
- Close other documents in Vexy Lines to free up rendering resources
Drag-and-drop doesn't work¶
This requires tkinterdnd2. If you installed with pip install vexy-lines-run, it should be included. On some Linux distributions, the underlying Tcl/Tk DnD extension may be missing. The app works without drag-and-drop: use the + buttons or the menu bar to add files.
Video has no audio in the output¶
Audio passthrough requires: (1) MP4 output format, (2) the full frame range selected, (3) the source video must have an audio track, and (4) ffmpeg must be installed and available on your PATH. If any condition isn't met, the audio toggle won't appear or audio will be silently dropped.
Preview images look wrong or blank¶
Previews are extracted from the .lines file's embedded PreviewDoc data (base64-encoded). If the .lines file was saved without a preview, or the preview data is corrupt, the preview area stays blank. This doesn't affect export, because the style and source image data are separate from the preview.
Window appears behind other windows¶
The app tries to bring itself to the front on launch. If it doesn't appear, check your taskbar/dock. On macOS, the window forces itself to the top briefly then drops back to normal stacking order.
Video Processing¶
How vexy-lines-run handles video input and output.
Supported containers¶
| Extension | Container | Notes |
|---|---|---|
.mp4 |
MPEG-4 / H.264 | Primary format; best compatibility |
.mov |
QuickTime | Common on macOS |
.mkv |
Matroska | Open container; widely supported |
.avi |
AVI | Legacy; no audio passthrough |
.webm |
WebM | VP8/VP9; no audio passthrough |
OpenCV (opencv-python-headless) handles frame extraction for all containers.
Output is always re-encoded MP4 (H.264 via OpenCV's VideoWriter) or individual
PNG/JPG frames. The app does not remux the original container.
Per-frame pipeline¶
Each styled frame goes through this sequence:
OpenCV VideoCapture
↓ read raw BGR frame (numpy ndarray, shape H×W×3)
cv2.imencode(".png")
↓ PNG bytes in memory (~1–3 MB for 1080p, versus ~6 MB uncompressed)
PIL Image.open(BytesIO(...))
↓ PIL Image in RGB
MCP apply_style(png_bytes) → SVG string
↓ (round-trip to Vexy Lines desktop app on localhost:47384)
svg_to_pil(svg, width, height)
↓ PIL Image in RGBA (rasterised by resvg-py or Pillow fallback)
PIL Image.convert("RGB") → numpy array
↓
cv2 VideoWriter.write(frame) [MP4 output]
— or —
PIL Image.save(path) [PNG/JPG frame output]
Memory behaviour¶
Frames are kept as in-memory PNG bytes while waiting for the MCP round-trip, not as raw numpy arrays. For a 1080p frame this is roughly 1–3 MB compressed versus 6 MB uncompressed. Only one frame is in the pipeline at a time; the app does not buffer frames ahead.
For a 5-second clip at 30 fps (150 frames), peak RAM usage is dominated by the single in-flight PNG plus the SVG string returned by the engine. Long clips do not accumulate in memory.
Job folder (crash-safe exports)¶
Every export creates a persistent job folder alongside the output file.
Intermediate artifacts (.lines documents, .svg exports, individual PNG
frames) are written there. If the export is interrupted, re-running it resumes
from the last completed frame rather than starting over.
The GUI never deletes job folders automatically. To start fresh, delete the
<output-stem>--job/ folder manually, or use the CLI with --force.
Audio passthrough¶
The audio toggle (♪) appears only when all of these are true:
- The loaded video has an audio stream (detected via
ffprobe). - Export format is MP4.
- The full frame range is selected (first frame to last).
- You are on the Video tab.
When audio passthrough is on, the app:
- Writes the styled video (video-only, no audio) to a temp file.
- Runs
ffmpeg -i <styled.mp4> -i <original.mp4> -c:v copy -c:a aac <output.mp4>to merge the audio track. - Deletes the temp file.
Why the full-range restriction? If you export only frames 10–50 of a 60-frame clip, the audio and video would be out of sync. For partial ranges the audio toggle is hidden and audio is silently dropped.
ffmpeg must be on your PATH. The app uses shutil.which("ffmpeg") to find
it. Without ffmpeg, audio passthrough is disabled regardless of the toggle
state.
SVG rasterisation¶
After the Vexy Lines engine returns an SVG string, it must be rasterised for raster outputs (PNG, JPG, MP4 frames). The app tries these in order:
- resvg-py (
resvg.svg_to_png): fast, correct, preferred. - Pillow fallback: returns a blank RGBA image of the correct size. Used
when
resvgis not installed. The resulting frame will be blank but the export will not fail.
Install resvg-py to get proper rasterisation:
pip install resvg-py
# or, with uv:
uv add resvg-py
Video probe¶
probe(path) uses cv2.VideoCapture to read:
width,height: frame dimensions in pixels.fps: frames per second (CAP_PROP_FPS).total_frames: frame count (CAP_PROP_FRAME_COUNT).duration:total_frames / fps.has_audio: detected separately viaffprobe(returnsFalseif ffprobe is unavailable).
probe opens the file only to read properties and closes it immediately. It
does not decode any frames.
Frame range semantics¶
Frame numbers in the GUI are 1-indexed (first frame = 1, last frame =
total_frames). Internally, the export pipeline converts to 0-indexed
ranges before passing them to the frame extractor. The UI-to-internal
conversion is (ui_start - 1, ui_end - 1).
Optional video extra¶
The video dependencies (opencv-python-headless, av) are pulled in
transitively by vexy-lines-apy for most installs. If your environment strips
transitive extras or you need to pin versions explicitly, install them directly:
pip install "vexy-lines-run[video]"
GUI Technical Documentation¶
This document describes the architecture, widget structure, and implementation details of the Vexy Lines Run GUI application.
Architecture overview¶
The GUI is a single-window CustomTkinter application. The App class owns the entire widget tree, manages internal state, and dispatches export work to a background thread via processing.py.
launch()
└─ App.__init__()
├─ _build_layout() # constructs all widgets
├─ _register_drop_targets() # sets up drag-and-drop
└─ mainloop() # Tk event loop
User clicks Export ▶
└─ _do_export()
├─ file dialog (save-as or folder)
├─ gather state (mode, paths, format, size, audio, range)
├─ disable button
└─ threading.Thread(target=_run_export, daemon=True)
└─ process_export(...)
├─ on_progress → self.after(0, _update_progress)
├─ on_complete → self.after(0, _export_complete)
└─ on_error → self.after(0, _export_error)
The App class inherits from customtkinter.CTk. When tkinterdnd2 is available, it also mixes in TkinterDnD.DnDWrapper via a dynamically constructed base class tuple and a custom metaclass (_AppMeta).
Widget hierarchy¶
Root level¶
App (customtkinter.CTk + optional TkinterDnD.DnDWrapper)
├── CTkMenuBar
└── root (customtkinter.CTkFrame, fg_color="transparent")
├── inputs_tabview (CTkTabview)
│ ├── Lines Tab
│ │ ├── content_frame (CTkFrame)
│ │ │ ├── lines_list_frame (CTkScrollableFrame)
│ │ │ └── lines_preview_label (CTkLabel)
│ │ └── controls_frame (CTkFrame)
│ │ ├── + button (CTkButton, _choose_lines)
│ │ ├── − button (CTkButton, _remove_selected_lines)
│ │ └── ✕ button (CTkButton, _clear_all_lines)
│ ├── Images Tab
│ │ ├── content_frame (CTkFrame)
│ │ │ ├── images_list_frame (CTkScrollableFrame)
│ │ │ └── images_preview_label (CTkLabel)
│ │ └── controls_frame (CTkFrame)
│ │ ├── + button (CTkButton, _choose_images)
│ │ ├── − button (CTkButton, _remove_selected_image)
│ │ └── ✕ button (CTkButton, _clear_all_images)
│ └── Video Tab
│ ├── previews_frame (CTkFrame)
│ │ ├── video_first_preview (CTkLabel)
│ │ └── video_last_preview (CTkLabel)
│ └── controls_frame (CTkFrame)
│ ├── range_row (CTkFrame, fg_color="transparent")
│ │ ├── video_start_entry (CTkEntry, width=60)
│ │ ├── video_range_slider (CTkRangeSlider)
│ │ ├── video_count_label (CTkLabel)
│ │ └── video_end_entry (CTkEntry, width=60)
│ └── path_row (CTkFrame, fg_color="transparent")
│ ├── + button (CTkButton, _choose_video)
│ ├── video_path_label (CTkLabel)
│ └── ✕ button (CTkButton, _clear_video)
├── styles_tabview (CTkTabview)
│ ├── Style Tab (key="start")
│ │ ├── content_frame (CTkFrame)
│ │ │ └── _style_previews["start"] (CTkLabel)
│ │ └── controls_frame (CTkFrame)
│ │ ├── + button (CTkButton, _choose_style_file("start"))
│ │ ├── _style_labels["start"] (CTkLabel)
│ │ └── ✕ button (CTkButton, _clear_style_file("start"))
│ └── End Style Tab (key="end")
│ ├── content_frame (CTkFrame)
│ │ └── _style_previews["end"] (CTkLabel)
│ └── controls_frame (CTkFrame)
│ ├── + button (CTkButton, _choose_style_file("end"))
│ ├── _style_labels["end"] (CTkLabel)
│ └── ✕ button (CTkButton, _clear_style_file("end"))
└── bottom_frame (CTkFrame)
├── "Export as" label (CTkLabel)
├── format_menu (CTkOptionMenu, values=SVG/PNG/JPG/MP4/LINES)
├── size_menu (CTkOptionMenu, values=—/1x/2x/3x/4x)
├── audio_toggle (CTkSwitch, text="♪")
└── convert_button (CTkButton, text="Export ▶")
Key components¶
1. Menu bar (CTkMenuBar)¶
Built using CTkMenuBar from CTkMenuBarPlus with CustomDropdownMenu for submenu support. Six cascading menus:
- File: Add Lines, Export ▶, Quit
- Lines: Add Lines, Remove Selected, Remove All Lines
- Image: Add Images, Remove Selected, Remove All Images
- Video: Add Video, Reset Range, Remove Video
- Style: Open Style, Open End Style, Reset Styles
- Export: Export ▶, Location, Format (submenu with SVG/PNG/JPG/MP4/LINES), Size (submenu with 1x/2x/3x/4x), Audio (submenu with On/Off)
Menu items call the same methods as their button counterparts. The menu helper methods (_menu_add_lines, _menu_add_images, _menu_add_video) first switch to the relevant tab, then open the file dialog.
2. Inputs panel (inputs_tabview)¶
A three-tab CTkTabview switching between input modes:
Lines tab¶
- List frame:
CTkScrollableFramecontainingCTkLabelwidgets for each .lines file. Click to select (highlighted in blue). - Preview label: Shows selected file's embedded preview image via
CTkLabelwithCTkImage. - Controls: +, −, ✕ buttons.
Images tab¶
- List frame: Same structure as Lines tab, but for image files.
- Preview label: Shows selected image thumbnail.
- Controls: +, −, ✕ buttons.
Video tab¶
- Previews: Two side-by-side
CTkLabelwidgets showing first and last frames of the selected range. - Range controls:
CTkEntryfor start frame,CTkRangeSlider(custom widget), frame count label,CTkEntryfor end frame. All on a single row. - Path controls: + button, path label (truncated), ✕ button.
3. Styles panel (styles_tabview)¶
Two-tab CTkTabview for start/end style selection. Each tab is built by _build_style_picker(tab, key) with:
- Preview:
CTkLabeldisplaying the style's preview image. - Controls: + button, truncated path label, ✕ button.
The entire panel is disabled (grayed out) when the Lines tab is active. The _update_styles_panel_state() method iterates through all child widgets and sets their state to "disabled" or "normal".
4. Output section (bottom_frame)¶
A single horizontal frame with:
- "Export as" label
- Format menu:
CTkOptionMenuwith all five format options always visible. - Size menu:
CTkOptionMenu. Shows "—" (disabled) for SVG/LINES; shows 1x/2x/3x/4x (enabled) for raster formats. - Audio toggle:
CTkSwitchwith text "♪". Visibility is conditional (see Audio Toggle Visibility below). - Export button:
CTkButton, red theme (fg_color="#D32F2F",hover_color="#B71C1C"), text changes during export to show progress.
Thread safety¶
Background export thread¶
Export runs on a daemon threading.Thread spawned from _do_export(). The thread calls process_export() from processing.py, which blocks until complete.
The three callback parameters use self.after(0, ...) to marshal UI updates back to the main Tk thread:
on_progress=lambda cur, tot, msg: self.after(0, self._update_progress, cur, tot, msg)
on_complete=lambda msg: self.after(0, self._export_complete, msg)
on_error=lambda msg: self.after(0, self._export_error, msg)
self.after(0, callback) schedules the callback on the Tk event loop's next iteration, guaranteeing it runs on the main thread. This is the only safe way to update tkinter widgets from a background thread.
No abort mechanism¶
The current implementation disables the Export button during export but does not provide a way to cancel a running export. There is no abort_event or stop button. The button re-enables on completion or error.
State accessed by the background thread¶
The background thread reads (but does not write) these attributes at spawn time via closure:
self._output_pathself.format_var.get()self.size_var.get()self.audio_var.get()self._video_range
Because these are read once at thread start and the UI is disabled during export, there are no race conditions.
CustomTkinter theming¶
Dark mode¶
launch() calls customtkinter.set_appearance_mode("dark") before creating the App. This sets the global theme to dark mode. All CustomTkinter widgets inherit the dark palette automatically.
Color scheme¶
| Element | Color | Notes |
|---|---|---|
| Window background | Inherited from CTk dark theme | Dark slate |
| Root frame | fg_color="transparent" |
Inherits parent |
| Placeholder images | #1d1f22 |
Dark grey, created by create_placeholder_image() |
| Export button resting | #D32F2F fg, #B71C1C hover |
Red theme |
| Selected file row | Blue highlight | Via CTkLabel configuration |
Layout grid¶
The root frame uses a 2-column, 2-row grid:
Column 0 (weight=3): inputs_tabview | Column 1 (weight=1): styles_tabview
Row 0 (weight=1): [tabviews fill available space]
Row 1 (weight=0): bottom_frame (spans both columns)
The 3:1 weight ratio gives the input panel roughly three-quarters of the width.
CTkRangeSlider custom widget¶
A dual-handle range slider bundled in widgets.py. Ported from Akash Bora's CTkRangeSlider (version 0.3) and bundled to avoid an external dependency.
Implementation¶
- Base class:
CTkBaseClassfrom CustomTkinter's core widget classes. - Drawing engine: A custom
CustomDrawEngineclass that wrapsCTkCanvasand draws rounded rectangles for the track and circular thumbs. - Platform-specific rendering:
- macOS:
circle_shapes(preferred) orfont_shapes - Other platforms:
font_shapesorpolygon_shapes - Mouse interaction: Binds
<Button-1>,<B1-Motion>,<ButtonRelease-1>,<Enter>,<Leave>on the canvas. Click anywhere on the track to jump the nearest thumb. Drag to slide. - Value clamping: The low thumb cannot exceed the high thumb and vice versa.
- Step quantization: When
number_of_stepsis set, values snap to discrete positions usinground(value * steps) / steps.
Integration with the Video tab¶
The slider is created with from_=0, to=1 and maps to the video's frame range. When the slider value changes (_on_video_slider_change), the normalised 0–1 values are scaled to 1-indexed frame numbers. A _syncing_video_controls flag prevents update loops between the slider and the text entries.
Variable binding¶
Supports two-way binding with tk.IntVar or tk.DoubleVar via the variables parameter (a tuple of two variables for low and high values). Variable changes update the slider, and slider changes update the variables.
Drag-and-drop implementation¶
How it works¶
When tkinterdnd2 is available, _register_drop_targets() registers multiple widgets per tab as drop targets:
- The tab frame itself
- The list frame (scrollable frame + its internal
_scrollable_frame) - The preview label
- For video: both preview labels and the path label
Each target gets drop_target_register(DND_FILES) and a <<Drop>> event binding to a handler (_on_lines_drop, _on_images_drop, _on_video_drop).
Path parsing¶
Drop data from tkinterdnd2 can arrive in two formats:
- Brace-enclosed: {/path/to/my file.png} (paths with spaces)
- Space-separated: /path/one.png /path/two.png
The drop handlers parse both formats. Duplicate paths are filtered out before adding to the list.
Graceful degradation¶
If tkinterdnd2 is not installed, TkinterDnD is set to None at import time, and _register_drop_targets() returns immediately. No error, no crash: the app lacks drag-and-drop. Users can still add files via buttons and menus.
Video processing pipeline¶
When the GUI dispatches a video export, the processing module handles the heavy lifting:
MP4 output (_process_video_to_mp4)¶
For each frame in range:
1. Read frame from source video (OpenCV VideoCapture)
2. Save frame as temporary PNG
3. If end_style: interpolate style at t = frame_position / total_frames
4. apply_style(client, style, tmp_png) → SVG string (via MCP)
5. _svg_to_pil(svg_string, width, height) → PIL Image (via svglab or resvg-py)
6. Convert PIL Image → OpenCV BGR frame
7. Write frame to output (OpenCV VideoWriter, mp4v codec)
8. Delete temporary PNG
After all frames:
If audio and full range:
ffmpeg -i video_only.mp4 -i original.mp4 -c:v copy -c:a aac → merged.mp4
Else:
Move video_only.mp4 to output path
Frame image output (_process_video_to_frames)¶
Same per-frame loop but writes individual image files (frame_000001.svg, frame_000001.png, etc.) instead of feeding into a VideoWriter.
SVG rasterisation (_svg_to_pil)¶
Two backends, tried in order:
- svglab: Parses SVG, sets width/height, calls
render(). Handles mm-unit dimensions natively. - resvg-py (fallback): Patches mm dimensions to px in the SVG string, writes to a temp file, calls
svg_to_bytes(). Decodes PNG bytes with Pillow.
Both backends resize the result to the target dimensions with Lanczos resampling if needed.
Audio merge¶
Audio passthrough uses ffmpeg as a subprocess:
ffmpeg -y -i video_only.mp4 -i original.mp4 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 -shortest merged.mp4
Audio detection uses ffprobe to check for audio streams in the source video. If ffprobe is not available, has_audio defaults to False.
UI state transitions¶
Tab switching (_on_inputs_tab_changed)¶
When switching between input tabs: 1. Update audio toggle visibility (only shown on Video tab with MP4 format and full range) 2. Update styles panel state (disabled on Lines tab, enabled on Images/Video)
Note: The format dropdown does not filter its options per tab. All five formats (SVG, PNG, JPG, MP4, LINES) are always available.
Format changes (_on_format_change)¶
When the export format changes: 1. Update size dropdown: vector formats (SVG, LINES) disable it and show "—"; raster formats (PNG, JPG, MP4) enable it with 1x–4x options 2. Update audio toggle visibility
Audio toggle visibility (_update_audio_toggle_visibility)¶
The audio switch is shown only when ALL conditions are true: - Video tab is active - A video is loaded with frames > 0 - The video has an audio track - Export format is MP4 - Full video range is selected (1 to total frames)
The visibility check runs on a 300ms polling timer (_poll_active_tab) in addition to being called on tab and format changes.
Responsive layout¶
Resize handling¶
<Configure>event fires on any window resize- A debounced handler (
_on_resize) schedules_resize_refresh()after 70ms, cancelling any pending refresh _resize_refresh()updates:- Image list layout (repacks rows with new widths)
- Lines list layout (same)
- Path label truncation (re-calculates character limits based on widget pixel width)
- All preview images are redrawn to fit new container sizes
Path truncation¶
Two truncation functions:
truncate_start(text, max_chars): trims leading characters:
def truncate_start(text: str, max_chars: int = 20) -> str:
if len(text) <= max_chars:
return text
return f"…{text[-max_chars:]}"
truncate_middle(text, max_width): replaces the middle with "⋮":
def truncate_middle(text: str, max_width: int) -> str:
if len(text) <= max_width:
return text
keep = max_width - 1
left = keep // 2
right = keep - left
return f"{text[:left]}⋮{text[-right:]}"
Font metrics are computed at init time using tkfont.nametofont() on the default CTkLabel font, enabling pixel-accurate truncation calculations.
State management¶
Internal state variables¶
| Variable | Type | Description |
|---|---|---|
_style_paths |
dict[str, str \| None] |
Maps "start"/"end" to file paths |
_style_labels |
dict[str, CTkLabel] |
Path display labels per style slot |
_style_previews |
dict[str, CTkLabel] |
Preview image labels per style slot |
_style_default_text |
dict[str, str] |
Placeholder text: {"start": "Style", "end": "End Style"} |
_image_paths |
list[str] |
Image file paths |
_image_rows |
list[CTkLabel] |
Row widgets in the image list |
_selected_image_index |
int \| None |
Currently selected image index |
_lines_paths |
list[str] |
Lines file paths |
_lines_rows |
list[CTkLabel] |
Row widgets in the lines list |
_selected_lines_index |
int \| None |
Currently selected lines index |
_video_path |
str |
Current video file path (empty string if none) |
_video_total_frames |
int |
Total frame count of loaded video |
_video_has_audio |
bool |
Whether the loaded video has an audio stream |
_video_range |
tuple[int, int] |
Selected frame range (1-indexed, inclusive) |
_syncing_video_controls |
bool |
Guard flag to prevent update loops |
_output_path |
str |
Last selected output path |
Tkinter variables¶
| Variable | Type | Description |
|---|---|---|
format_var |
tk.StringVar |
Current export format, initial value "SVG" |
size_var |
tk.StringVar |
Current size multiplier, initial value "—" |
audio_var |
tk.BooleanVar |
Include audio, initial value True |
Window lifecycle¶
Initialization¶
App.__init__() calls, in order:
1. super().__init__(): creates the Tk window
2. TkinterDnD initialization (if available)
3. Window configuration: title, geometry (900x700), minsize (960x480)
4. State variable initialization
5. Font metrics setup for truncation
6. _build_layout(): constructs all widgets
7. _register_drop_targets(): sets up drag-and-drop
8. Initial state updates (size dropdown, audio toggle, styles panel)
9. <Configure> event binding for resize handling
10. Raise to front: lift(), attributes("-topmost", True), then after 200ms set -topmost back to False
Launch¶
launch() sets dark appearance mode, creates the App, lifts it again (belt and suspenders), and enters mainloop().
Key method architecture¶
Layout builders¶
_build_layout(): top-level structure (root frame, grid)_build_menu_bar(): menu construction with CTkMenuBar_build_inputs_panel(): tabview with three tabs_build_lines_tab(): lines-specific widgets_build_images_tab(): image-specific widgets_build_video_tab(): video-specific widgets_build_styles_panel(): style tabview with two tabs_build_style_picker(): reusable per-slot style picker_build_outputs_section(): export controls bar
Export flow¶
_do_export(): file dialog, gather state, spawn thread_run_export(): background thread entry point_update_progress(): update button text with percentage (main thread)_export_complete(): re-enable button (main thread)_export_error(): re-enable button, show error dialog (main thread)
Video range management¶
_set_video_range(): validates and sets range, updates slider/entries/previews_on_video_slider_change(): handles slider input, converts normalised values to frame numbers_on_video_entries_submit(): handles text entry input (Return key or focus-out)_syncing_video_controls: flag to prevent circular updates between slider and entries
Image management¶
_set_label_image(): fits and sets a PIL image on a CTkLabelfit_image_to_box(): aspect-ratio-preserving scale onto a dark canvas_redraw_*_preview(): refresh specific preview widgets after selection or resize
File extension constants¶
Defined at module level:
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp"}
VIDEO_EXTENSIONS = {".mp4", ".mov", ".avi", ".mkv", ".webm"}
LINES_EXTENSIONS = {".lines"}
Dependencies¶
Required (installed with the package)¶
| Package | Purpose |
|---|---|
customtkinter |
Modern tkinter wrapper with dark mode |
CTkMenuBarPlus |
Enhanced menu bar with cascading dropdown menus |
Pillow (PIL) |
Image loading, thumbnails, format conversion |
loguru |
Debug logging |
vexy-lines-apy |
MCP client and style engine bindings |
Required for video processing¶
| Package | Purpose |
|---|---|
opencv-python-headless (cv2) |
Video frame reading and writing |
svglab or resvg-py |
SVG-to-raster conversion |
numpy |
Array conversion between PIL and OpenCV |
Optional¶
| Package | Purpose |
|---|---|
tkinterdnd2 |
Drag-and-drop support. Falls back gracefully if missing. |
ffmpeg (system binary) |
Audio track merging for MP4 output |
ffprobe (system binary) |
Audio stream detection in source videos |
API Reference¶
App¶
App(customtkinter.CTk)¶
The main GUI window. Handles layout, file management, style selection, and export dispatch.
from vexy_lines_run import App
app = App()
app.mainloop()
Window defaults: Title "Style with Vexy Lines", 900x700, minimum 960x480.
Constructor: Takes no arguments. Builds the entire widget tree, registers drop targets, and configures initial state.
Key instance attributes:
| Attribute | Type | Description |
|---|---|---|
format_var |
tk.StringVar |
Current export format ("SVG", "PNG", "JPG", "MP4", "LINES") |
size_var |
tk.StringVar |
Current size multiplier ("1x", "2x", "3x", "4x", or "—") |
audio_var |
tk.BooleanVar |
Include audio in video exports |
inputs_tabview |
CTkTabview |
The Lines/Images/Video tab container |
styles_tabview |
CTkTabview |
The Style/End Style tab container |
convert_button |
CTkButton |
The Export/Stop button |
Internal state (not part of public API but useful to understand):
| Attribute | Type | Description |
|---|---|---|
_style_paths |
dict[str, str \| None] |
Maps "start"/"end" to loaded style file paths |
_image_paths |
list[str] |
Loaded image file paths |
_lines_paths |
list[str] |
Loaded .lines file paths |
_video_path |
str |
Loaded video file path (empty if none) |
_video_total_frames |
int |
Frame count of loaded video |
_video_has_audio |
bool |
Whether loaded video has an audio stream |
_video_range |
tuple[int, int] |
Selected frame range (1-indexed, inclusive) |
_output_path |
str |
Last selected output directory or file path |
launch() -> None¶
Creates an App and calls mainloop(). Sets CustomTkinter to dark appearance mode. The simplest way to start the GUI.
from vexy_lines_run import launch
launch()
Equivalent to:
import customtkinter
from vexy_lines_run import App
customtkinter.set_appearance_mode("dark")
app = App()
app.lift()
app.attributes("-topmost", True)
app.after(100, lambda: app.attributes("-topmost", False))
app.mainloop()
Processing¶
process_export(...) -> None¶
The export pipeline. Dispatches to mode-specific processors based on the mode parameter. Called by App on a background thread, but works fine called directly for scripting.
from vexy_lines_run.processing import process_export
process_export(
mode="images",
input_paths=["photo.jpg"],
style_path="style.lines",
end_style_path=None,
output_path="./output",
fmt="SVG",
size="1x",
audio=False,
frame_range=None,
)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
mode |
str |
— | "lines", "images", or "video" |
input_paths |
list[str] |
— | Paths to input files. For video mode, a single-element list with the video path. |
style_path |
str \| None |
— | Path to primary .lines style file, or None |
end_style_path |
str \| None |
— | Path to end .lines style file for interpolation, or None |
output_path |
str |
— | Output directory (or .mp4 filepath for video MP4 mode) |
fmt |
str |
— | "SVG", "PNG", "JPG", "MP4", or "LINES" |
size |
str |
— | "1x", "2x", "3x", "4x", or "—" |
audio |
bool |
— | Include audio track in MP4 output (keyword-only) |
frame_range |
tuple[int, int] \| None |
— | Start and end frame numbers (1-indexed, inclusive) for video mode. None means all frames. (keyword-only) |
on_progress |
Callable[[int, int, str], None] \| None |
None |
Called with (current, total, message) after each file/frame |
on_complete |
Callable[[str], None] \| None |
None |
Called with a summary message on success |
on_error |
Callable[[str], None] \| None |
None |
Called with an error message on failure |
Note: audio and frame_range are keyword-only parameters.
Mode behavior:
| Mode | Style required? | What happens |
|---|---|---|
"lines" + LINES |
No | File copy to output directory |
"lines" + PNG/JPG |
No | Extracts embedded preview image from each .lines file |
"lines" + SVG |
N/A | Returns error: SVG export from .lines requires Images mode with a style |
"images" |
Yes | Applies style to each image via MCP. Each image → new Vexy Lines document → apply fill tree → render → export SVG → optionally rasterise |
"video" + MP4 |
Yes | Full video re-encode with per-frame style transfer. Audio passthrough when audio=True and source has audio and full range selected. |
"video" + PNG/JPG/SVG |
Yes | Extracts frames, styles each one, saves as frame_NNNNNN.ext |
Callbacks are invoked on the calling thread. When App uses this function, it marshals them to the main Tk thread via self.after(0, callback).
Exceptions are caught internally and passed to on_error. The function does not raise.
Size multiplier parsing¶
The size string is parsed internally by _parse_size_multiplier():
| Input | Multiplier | Effect |
|---|---|---|
"1x" |
1.0 | Original resolution |
"2x" |
2.0 | Double width and height (Lanczos resampling) |
"3x" |
3.0 | Triple |
"4x" |
4.0 | Quadruple |
"—" |
1.0 | Same as 1x (used for SVG/LINES) |
Values below 1.0 are clamped to 1.0.
Progress reporting¶
The on_progress callback receives three arguments:
current(int): 0-indexed count of processed itemstotal(int): total number of items to processmessage(str): human-readable status, e.g."Styling bear_03..."or"Frame 5/30"or"Done"
The final call is always (total, total, "Done") on success.
Error handling and recovery¶
All exceptions inside process_export() are caught and routed to on_error. The function never raises. Error messages include:
| Error | Cause |
|---|---|
"No input files selected." |
Empty input_paths list |
"A style file is required for Images mode." |
style_path is None in images mode |
"A style file is required for Video mode." |
style_path is None in video mode |
"Failed to read style: ..." |
Style .lines file can't be parsed |
"Start and end styles have incompatible structures." |
End style doesn't match start style's fill tree |
"MCP error: ...\n\nMake sure Vexy Lines is running." |
MCP connection refused or tool call failed |
"SVG export from .lines files requires the Vexy Lines app (MCP)." |
SVG format selected in lines mode |
"Unsupported format for Lines mode: ..." |
Invalid format for the mode |
Video¶
Re-exported from vexy_lines_api.video. Video dependencies (OpenCV, svglab/resvg-py) must be installed.
VideoInfo¶
Dataclass with video file metadata.
from dataclasses import dataclass
@dataclass
class VideoInfo:
width: int # Frame width in pixels
height: int # Frame height in pixels
fps: float # Frames per second
total_frames: int # Total frame count
duration: float # Duration in seconds
has_audio: bool # Whether an audio stream exists
probe(path: str | Path) -> VideoInfo¶
Read video metadata without decoding any frames. Uses OpenCV's VideoCapture for dimensions/fps/frame count and ffprobe for audio detection. Returns instantly even for large files.
from vexy_lines_run.video import probe
info = probe("clip.mp4")
print(f"{info.width}x{info.height} @ {info.fps}fps")
print(f"{info.total_frames} frames, {info.duration:.1f}s")
print(f"Audio: {'yes' if info.has_audio else 'no'}")
Raises:
- RuntimeError if the video file can't be opened
- ImportError if opencv-python-headless is not installed
Audio detection: Uses ffprobe (best-effort). If ffprobe is not on PATH, has_audio returns False.
process_video(...) -> VideoInfo¶
Low-level video processing: decode frames, apply a single fill type per frame, re-encode. This is the standalone function that creates fills from scratch (fill_type + params), not from a .lines style file.
from vexy_lines_run.video import process_video
def frame_callback(frame_index, total_frames):
progress = frame_index / max(total_frames - 1, 1)
return {"angle": progress * 180.0, "interval": 15.0}
info = process_video(
input_path="clip.mp4",
output_path="result.mp4",
fill_type="linear",
color="#000000",
interval=20,
thickness=15,
frame_params=frame_callback,
max_frames=100,
host="127.0.0.1",
port=47384,
dpi=72,
)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
input_path |
str \| Path |
— | Source video file |
output_path |
str \| Path |
— | Destination video file |
fill_type |
str |
"linear" |
Fill algorithm name |
color |
str |
"#000000" |
Fill colour as hex string |
interval |
float |
20 |
Spacing between strokes in pixels |
thickness |
float |
15 |
Maximum stroke thickness |
thickness_min |
float |
0 |
Minimum stroke thickness |
dpi |
int |
72 |
Document DPI for the Vexy Lines engine |
frame_params |
Callable[[int, int], dict] \| None |
None |
Called with (frame_index, total_frames), returns fill parameter overrides. When None, angle rotates from 0 to 180 degrees across the video. |
max_frames |
int \| None |
None |
Limit processing to first N frames |
on_progress |
Callable[[int, int], None] \| None |
None |
Called with (frame_index, total_frames) after each frame |
host |
str |
"127.0.0.1" |
MCP server host |
port |
int |
47384 |
MCP server port |
timeout |
float |
60.0 |
Render timeout per frame in seconds |
Returns: VideoInfo of the input video.
Raises:
- ImportError if required packages are missing
- MCPError if the MCP server is unreachable
process_video_with_style(...) -> VideoInfo¶
Higher-level video processing using extracted Style objects. Supports style interpolation across a frame range. This is what the GUI's processing pipeline uses internally.
from vexy_lines_run.video import process_video_with_style
from vexy_lines_api.style import extract_style
style = extract_style("halftone.lines")
end_style = extract_style("scribble.lines")
info = process_video_with_style(
input_path="clip.mp4",
output_path="result.mp4",
style=style,
end_style=end_style,
start_frame=0,
end_frame=150,
dpi=72,
)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
input_path |
str \| Path |
— | Source video file |
output_path |
str \| Path |
— | Destination video file |
style |
Style |
— | Start style object (from extract_style()) |
end_style |
Style \| None |
None |
End style for interpolation |
dpi |
int |
72 |
Document DPI |
max_frames |
int \| None |
None |
Limit frames from start_frame |
start_frame |
int |
0 |
First frame to process (0-based, inclusive) |
end_frame |
int \| None |
None |
Last frame to process (0-based, exclusive). None = all frames. |
on_progress |
Callable[[int, int], None] \| None |
None |
Called with (frame_index, total_frames) |
host |
str |
"127.0.0.1" |
MCP server host |
port |
int |
47384 |
MCP server port |
timeout |
float |
60.0 |
Render timeout per frame |
Returns: VideoInfo of the input video.
Note: start_frame and end_frame are 0-based in this function, unlike the GUI which presents 1-indexed values to the user.
Widgets¶
CTkRangeSlider¶
A dual-handle range slider for CustomTkinter. Used in the Video tab to select frame ranges. Works as a standalone widget in any CustomTkinter app.
import customtkinter as ctk
from vexy_lines_run.widgets import CTkRangeSlider
slider = CTkRangeSlider(
parent,
from_=0,
to=100,
number_of_steps=100,
command=lambda low, high: print(f"{low}-{high}"),
)
slider.pack(fill="x", padx=10)
Constructor parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
master |
widget | — | Parent widget |
width |
int |
200 |
Widget width (horizontal) or 16 (vertical) |
height |
int |
16 |
Widget height (horizontal) or 200 (vertical) |
corner_radius |
int |
auto | Track corner radius |
button_corner_radius |
int |
auto | Thumb corner radius |
border_width |
int |
0 |
Track border width |
button_length |
int |
auto | Thumb width in pixels |
fg_color |
str \| tuple |
theme | Track background color |
border_color |
str \| tuple |
theme | Track border color |
progress_color |
str \| tuple |
theme | Color of the bar between thumbs |
button_color |
str \| tuple |
theme | Thumb color (or tuple for individual thumbs) |
button_hover_color |
str \| tuple |
theme | Thumb color on hover |
from_ |
float |
0 |
Minimum output value |
to |
float |
1 |
Maximum output value |
number_of_steps |
int \| None |
None |
Quantize to this many steps (e.g. 100 for integer percentages) |
state |
str |
"normal" |
"normal" or "disabled" |
hover |
bool |
True |
Enable hover highlighting on thumbs |
command |
callable \| None |
None |
Called with (low, high) on every value change |
variables |
tuple[tk.Variable, tk.Variable] \| None |
None |
Bind to two Tk variables for two-way sync |
orientation |
str |
"horizontal" |
"horizontal" or "vertical" |
Methods:
| Method | Returns | Description |
|---|---|---|
get() |
tuple[float, float] |
Current (low, high) output values |
set(values) |
— | Set both values. Accepts [low, high] list. |
configure(**kwargs) |
— | Update any constructor parameter at runtime |
cget(name) |
object |
Read a property value |
bind(seq, cmd) |
— | Bind an event handler (preserves internal bindings) |
unbind(seq) |
— | Remove an event handler |
focus() |
— | Give keyboard focus to the slider |
Interaction behavior:
- Click anywhere on the track to jump the nearest thumb to that position
- Drag a thumb to slide it
- Hovering over a thumb highlights it (if
hover=True) - The slider prevents the low thumb from exceeding the high thumb and vice versa
- With
number_of_stepsset, values snap to discrete positions
Theming: Follows CustomTkinter's dark/light appearance mode. All colors accept (light_value, dark_value) tuples for per-mode styling. The drawing engine auto-selects the best rendering backend for the platform (circle_shapes on macOS, font_shapes elsewhere).
Utility functions¶
These are internal to app.py but useful to understand:
extract_preview_from_lines(filepath: str) -> Image.Image | None¶
Extract the embedded preview image from a .lines file. Parses the XML, looks for the PreviewDoc element, decodes the base64 content. Returns a PIL Image or None if extraction fails (missing element, corrupt data, parse error).
extract_frame(video_path: str, frame_number: int) -> Image.Image | None¶
Extract a single frame from a video file using OpenCV. Frame numbers are 1-indexed. Returns a PIL Image in RGB mode, or None if extraction fails or OpenCV is not installed.
fit_image_to_box(image: Image.Image, width: int, height: int) -> Image.Image¶
Scale an image to fit within the given box while preserving aspect ratio. Uses Lanczos resampling. The result is pasted onto a dark canvas (#1d1f22) at position (0, 0), so the image sits in the top-left corner with dark padding on the right and/or bottom.
truncate_start(text: str, max_chars: int = 20) -> str¶
Trim leading characters, keeping only the last max_chars characters. Prepends "…" if truncated.
truncate_middle(text: str, max_width: int) -> str¶
Shorten text by replacing the middle with "⋮", keeping roughly equal amounts from the start and end.
create_placeholder_image(width: int, height: int, text: str) -> Image.Image¶
Returns a plain dark-grey (#1d1f22) image. The text parameter is accepted but not rendered: the placeholder is a solid color block.
Examples¶
Launch the app¶
From the terminal:
vexy-lines-run
From Python:
from vexy_lines_run import launch
launch()
As a module:
python -m vexy_lines_run
All three do the same thing: open the GUI in dark mode.
Batch convert .lines files to SVG¶
You have a folder of .lines documents and want PNG or JPG versions of their embedded previews.

- Switch to the Lines tab
- Click + and select your
.linesfiles (or drag them onto the file list) - Set format to PNG or JPG
- Click Export ▶ and choose an output folder
- Each file's embedded preview image is extracted and saved
No style needed: Lines mode extracts previews directly from the files.
Want plain copies? Set format to LINES and the files are copied to the output folder. No MCP, no rendering, only a file copy.
Want SVG output? SVG export from .lines files isn't available in Lines mode. Instead, switch to Images mode, load the source images, pick a style, and export as SVG. Or use the CLI for direct MCP-based export.
Apply a halftone style to 50 product photos¶
You have 50 product photos. You want them all rendered as halftone vector art.

- Switch to the Images tab
- Click + and select all 50 photos (PNG, JPG, WEBP, or any other raster format)
- Click + in the Style panel and pick a
.linesfile with the halftone look you want - The style preview appears immediately. Check it's the right one
- Choose SVG for vector output, or PNG/JPG with a size multiplier (2x doubles the resolution)
- Click Export ▶ and choose an output folder
- The export button shows progress: "35% Styling product_07..."
- Done. Fifty styled images in the output folder, named after the originals
If one photo fails (corrupt file, MCP timeout), the app logs a warning and moves on. The other 49 still export.
Re-export .lines files with a different style¶
You have a collection of .lines documents and want to apply a completely different artistic style to all of them.
- Switch to the Lines tab
- Drag your
.linesfiles onto the file list (or use +) - In the Style panel, load the new style you want to apply
Wait: the Style panel is grayed out on the Lines tab. That's by design: .lines files carry their own fill structure. To restyle them:
- Extract the source images from the
.linesfiles first (export as PNG from Lines mode) - Switch to the Images tab
- Load the extracted PNGs
- Now load the new style in the Style panel
- Export as SVG/PNG/JPG
Style interpolation across a sequence¶
Load 60 frames from an animation. Set a "clean lines" primary style and a "chaotic scribble" end style. Frame 1 gets pure clean lines, frame 60 gets pure scribble, and everything in between blends proportionally.
- Load your frames in the Images tab (JPGs named
frame_001.jpgthroughframe_060.jpg) - Click + in the Style panel and pick the clean lines style
- Switch to the End Style tab and click + to pick the scribble style
- Export as PNG at 2x
The blend factor t for frame i of N total frames is i / (N - 1). Both styles must be structurally compatible: same number of groups, layers, and fills with matching fill types. If they don't match, the export will show an error.
Create a 30-second styled video from MP4¶
Turn a 30-second clip into vector art, frame by frame.

- Switch to the Video tab
- Click + and load your
clip.mp4 - The first and last frames appear as previews. The range slider shows 1 to total frames.
- For a test run, narrow the range to just 5-10 frames (drag the slider handles or type exact frame numbers)
- Load a style in the Style panel
- Choose MP4 as format
- Click Export ▶ and pick a save location
- The button shows progress: "3% Frame 12/450"
- Once satisfied with a test, reset the range (Video menu > Reset Range) and export the full video
Audio passthrough¶
If the source video has audio, the audio toggle (♪) appears when: - Format is MP4 - Full frame range is selected - You're on the Video tab
Toggle it on to keep the original audio. The app writes styled video first, then merges audio using ffmpeg. Make sure ffmpeg is on your PATH.
Export as frame images instead¶
Choose PNG or JPG instead of MP4. The app saves each frame as a separate file (frame_000001.png, frame_000002.png, etc.) in the folder you choose. Useful when you want to assemble the video yourself or need individual frames for compositing.
Process video with frame range selection¶
You only want frames 100–200 of a 1000-frame video:
- Load the video on the Video tab
- Type
100in the start entry, press Enter - Type
200in the end entry, press Enter - The previews update to show frame 100 and frame 200
- The count label reads "101 frames"
- Load a style and export
The frame range is 1-indexed and inclusive. Frame 100 and frame 200 are both included in the output.
Note: Audio passthrough is only available when the full frame range is selected. Partial ranges always produce silent video.
Use style interpolation for an animated video¶
Combine video processing with style interpolation to create a gradually transforming effect:
- Load a video on the Video tab
- Load a "clean lines" style as the primary style
- Switch to End Style and load a "scribble" style
- The first frame gets 100% clean lines, the last frame gets 100% scribble, and everything in between blends smoothly
- Export as MP4
This works for frame image export too: each frame file gets the interpolated style for its position in the sequence.
Drag-and-drop workflow¶
Skip file dialogs entirely:
- Drag
.linesfiles onto the Lines tab list or preview area - Drag photos onto the Images tab list or preview area
- Drag a video onto the Video tab preview areas or path label
- Drag a
.linesfile onto the Style panel to load it as primary style - Drag a
.linesfile onto the End Style panel to load it as end style
The app filters by extension. Dropping a PNG on the Lines tab does nothing. Dropping a duplicate file is silently ignored.
Probe video metadata from Python¶
from vexy_lines_run.video import probe
info = probe("clip.mp4")
print(f"Resolution: {info.width}x{info.height}")
print(f"FPS: {info.fps}")
print(f"Frames: {info.total_frames}")
print(f"Duration: {info.duration:.1f}s")
print(f"Audio: {'yes' if info.has_audio else 'no'}")
probe() reads metadata without decoding frames, so it returns instantly even for large files. Requires OpenCV.
Use the range slider widget standalone¶
The dual-handle range slider is a reusable CustomTkinter widget. Use it in your own apps:
import customtkinter as ctk
from vexy_lines_run.widgets import CTkRangeSlider
root = ctk.CTk()
root.geometry("400x100")
def on_change(low, high):
print(f"Range: {low:.0f} – {high:.0f}")
slider = CTkRangeSlider(
root,
from_=0,
to=300,
number_of_steps=300, # integer steps
command=on_change,
)
slider.pack(padx=20, pady=20, fill="x")
root.mainloop()
The slider supports horizontal and vertical orientations, variable binding (tk.IntVar / tk.DoubleVar), step quantization, hover highlighting, and full CustomTkinter theming (dark/light mode, custom colors).
Run the processing pipeline from a script¶
For automation without the GUI, call the processing module directly:
from vexy_lines_run.processing import process_export
def on_progress(current, total, message):
print(f"[{current}/{total}] {message}")
def on_complete(message):
print(f"Done: {message}")
def on_error(message):
print(f"Error: {message}")
# Style transfer on a batch of images
process_export(
mode="images",
input_paths=["photo1.jpg", "photo2.jpg", "photo3.jpg"],
style_path="halftone.lines",
end_style_path=None,
output_path="./output",
fmt="SVG",
size="1x",
audio=False,
frame_range=None,
on_progress=on_progress,
on_complete=on_complete,
on_error=on_error,
)
This runs synchronously on the calling thread. To run in the background (like the GUI does), wrap it in a threading.Thread:
import threading
thread = threading.Thread(
target=process_export,
kwargs={
"mode": "images",
"input_paths": ["photo1.jpg"],
"style_path": "style.lines",
"end_style_path": None,
"output_path": "./output",
"fmt": "PNG",
"size": "2x",
"audio": False,
"frame_range": None,
"on_progress": on_progress,
"on_complete": on_complete,
"on_error": on_error,
},
daemon=True,
)
thread.start()
thread.join() # wait for completion
Extract .lines previews from a script¶
from vexy_lines_run.app import extract_preview_from_lines
image = extract_preview_from_lines("artwork.lines")
if image is not None:
image.save("preview.png")
print(f"Extracted {image.size[0]}x{image.size[1]} preview")
else:
print("No preview image found in file")
Process video with style objects from Python¶
For full control over video processing with style interpolation:
from vexy_lines_run.video import process_video_with_style
from vexy_lines_api.style import extract_style, styles_compatible
start = extract_style("clean_lines.lines")
end = extract_style("scribble.lines")
if not styles_compatible(start, end):
print("Styles are not compatible for interpolation")
else:
info = process_video_with_style(
input_path="clip.mp4",
output_path="styled_clip.mp4",
style=start,
end_style=end,
start_frame=0, # 0-based
end_frame=150, # 0-based, exclusive
dpi=72,
on_progress=lambda i, t: print(f"Frame {i}/{t}"),
)
print(f"Processed {info.total_frames} frames")
Note: start_frame and end_frame in process_video_with_style() are 0-based, unlike the GUI's 1-indexed display.
Changelog¶
See CHANGELOG.md for the full release history.
Documentation Style Guide¶
Rules for writing vexy-lines-run documentation.
Voice and tone¶
- Second person, active voice. "Click + to add files" not "Files can be added by clicking the plus button."
- Direct. State what the user does and what happens. Omit filler phrases ("simply", "just", "easily", "please note that").
- Precise over friendly. "The toggle is hidden when format is not MP4" is better than "The audio toggle might not show up in some cases."
- No exclamation marks.
Structure¶
- Start every page with a one-sentence statement of purpose.
- Use H2 (
##) for major sections, H3 (###) for subsections. Avoid H4. - Lead with the common case. Put edge cases, errors, and caveats in later sections or collapsed admonitions.
- Tables for comparisons (format options, platform notes, error messages).
- Fenced code blocks for every command, snippet, and file path.
Language¶
- Package name:
vexy-lines-run(lowercase, hyphenated) in prose and as the PyPI name.vexy_lines_runonly in Python import paths. - "The app" not "the application" or "the tool."
- "Export ▶" (with the Unicode play symbol) when referring to the button label.
- "Style panel" not "style picker" or "style selector."
- "
.linesfile" (backtick around the extension, space before "file"). - "MCP" when referring to the protocol or server; "Vexy Lines app" when referring to the desktop application that runs the server.
- Frame numbers are 1-indexed in user-facing text ("frame 1" = first frame).
Code blocks¶
Specify the language for every fenced block:
```bash
pip install vexy-lines-run
```
Use bash for shell commands, python for Python snippets, bat for
Windows batch commands, yaml for YAML.
File and path conventions¶
- Use POSIX paths in examples unless the example is Windows-specific.
- Truncate long paths with
…from the left:…/projects/art/kitty.lines. - Use
<placeholder>angle-bracket syntax for values the user must supply.
Admonitions¶
Use MkDocs admonitions sparingly:
!!! note
For something genuinely easy to miss.
!!! warning
For something that causes data loss or a hard-to-debug failure.
Do not use admonitions for normal caveats: put those inline.
Screenshots and diagrams¶
- ASCII art diagrams are preferred over images when the structure can be expressed clearly in text (layout grids, pipeline flows).
- When referencing a screenshot, add alt text that describes what is shown
functionally:
. - Do not use screenshots for error dialogs or text that can be reproduced as a code block.
Changelog entries¶
Format: YYYY-MM-DD — Short Title (Issue #N if applicable)
Then bullet points grouped by type:
- **feat**: What was added.
- **fix**: What was corrected.
- **docs**: Documentation-only change.
- **refactor**: Internal restructuring with no user-visible effect.
- **test**: Test additions or fixes.
End each changelog entry with - **test**: N tests passing.
Navigation¶
New pages go in mkdocs.yml under nav: in logical reading order:
- Overview / index
- Installation and troubleshooting
- User-facing guides (GUI Tour, GUI Guide)
- Technical reference (video processing, API reference)
- Examples
- Changelog
Do not nest nav entries more than one level deep.
Topics¶
Find related pages by topic.