Skip to content

FrankEBailey/svgthumb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVGThumb.wlx — SVG Thumbnail Plugin for Total Commander

A standalone SVG thumbnail and preview plugin for Total Commander. No Inkscape, no ImageMagick, no external dependencies — just drop it in and go.

Features

  • Thumbnail view (Ctrl+Shift+F1): See SVG previews right in the file panel
  • Quick view (Ctrl+Q): Preview SVGs in the lister panel
  • Full lister (F3): Open SVGs in the lister window
  • File navigation: Arrow keys to browse between SVG files in lister
  • Handles .svg and .svgz extensions
  • Lightweight: ~50-80 KB compiled DLL
  • Works with both 32-bit and 64-bit Total Commander
  • Uses NanoSVG (public domain) for rendering

Quick Start

Prerequisites

You need either:

  • MinGW-w64 (recommended) — available from mingw-w64.org or via MSYS2
  • Visual Studio with C/C++ workload (use Developer Command Prompt)

Step 1: Download NanoSVG headers

Download these two files from memononen/nanosvg:

  • nanosvg.h
  • nanosvgrast.h

Place them in the src\ directory alongside svgthumb.c.

Step 2: Build

With MinGW-w64:

build.bat

With MSVC:

build_msvc.bat

This produces:

  • build\svgthumb.wlx (32-bit)
  • build\svgthumb.wlx64 (64-bit)

Step 3: Install in Total Commander

Option A — Automatic:

  1. Open the build\ directory in Total Commander
  2. Double-click svgthumb.wlx — TC will offer to install it

Option B — Manual:

  1. Go to Configuration → Options → Plugins → LS (Lister)
  2. Click Add and select svgthumb.wlx (or .wlx64 for 64-bit TC)
  3. The detect string EXT="SVG" | EXT="SVGZ" will be auto-filled

Step 4: Use it

  • Switch to thumbnail view: Ctrl+Shift+F1
  • Quick preview panel: Ctrl+Q
  • Full preview: F3 on any SVG file

How It Works

The plugin exports the standard Total Commander WLX interface functions:

Function Purpose
ListGetDetectString Tells TC we handle .svg and .svgz files
ListGetPreviewBitmap Renders SVG → HBITMAP for thumbnail view
ListLoad Creates preview window for F3/Ctrl+Q
ListLoadNext Handles file navigation in lister
ListCloseWindow Cleanup

NanoSVG parses the SVG XML into vector paths, then rasterizes them to an RGBA pixel buffer at the requested thumbnail size. The plugin converts this to a Windows DIB Section (HBITMAP) that TC can display.

SVG Support

NanoSVG handles most common SVG features including:

  • Basic shapes (rect, circle, ellipse, line, polyline, polygon)
  • Paths with cubic bezier curves
  • Fill and stroke colors (named colors, hex, rgb)
  • Gradients (linear and radial)
  • Transforms (translate, rotate, scale, matrix)
  • ViewBox and units
  • Groups and layering
  • Opacity

Not supported (NanoSVG limitations):

  • Text elements (rendered as paths if converted)
  • Filters (blur, drop-shadow, etc.)
  • Animations
  • JavaScript / interactivity
  • CSS stylesheets (inline styles work)
  • <use> / <defs> references (partial support)

For most icon/illustration SVGs (like those from OpenClipart, Flaticon, etc.), rendering will be excellent. Complex SVGs with heavy text or CSS may not render perfectly — but you'll still get a recognizable thumbnail.

Project Structure

svgthumb_wlx/
├── src/
│   ├── svgthumb.c         # Plugin source code
│   ├── svgthumb.def       # DLL exports definition
│   ├── nanosvg.h          # ← download from GitHub
│   └── nanosvgrast.h      # ← download from GitHub
├── build.bat              # MinGW build script
├── build_msvc.bat         # MSVC build script
├── pluginst.inf           # TC auto-install descriptor
└── README.md              # This file

Technical Notes

  • The plugin uses __stdcall calling convention as required by TC's plugin interface
  • The .def file ensures proper export decoration (no name mangling)
  • -Wl,--kill-at (MinGW) strips the @nn decoration from stdcall exports
  • Thumbnails are rendered as 24-bit DIBs (TC standard)
  • SVGs with transparency are alpha-blended against a white background
  • The lister window supports resizing and repainting

License

Plugin code: MIT License NanoSVG: zlib/libpng license (public domain compatible)

Credits

  • NanoSVG by Mikko Mononen
  • Total Commander WLX SDK by Christian Ghisler
  • Plugin built with Claude (Anthropic)

About

A zero-external-dependencies SVG thumbnail plugin for the excellent Total Commander file manager

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors