A minimal, cross-platform native codec plugin for ImageGlass v10 that teaches
the in-process native plugin ABI (ImageGlass.SDK.Plugins / IGNativeAbi) with
the smallest interesting codec: it adds support for .b64 files.
| Extension | What it does |
|---|---|
.b64 |
Reads a base64-encoded image from a text file and decodes it to a raster image |
A .b64 file is just a text file holding a base64 string. Two shapes are accepted:
- A raw base64 payload —
iVBORw0KGgoAAAANSUhEUgAA... - A data URI —
data:image/png;base64,iVBORw0KGgo...
Whitespace and newlines anywhere in the payload are ignored.
- Exports the well-known C entry point
ig_plugin_get_api - Advertises one static-image codec (
plugin.base64.codec) for.b64 - Implements
LoadMetadataandDecodeStaticRaster:File.ReadAllText→ strip an optionaldata:…;base64,prefixConvert.FromBase64String→ original image bytes (PNG/JPEG/WebP/…)SKCodecdecodes those bytes straight into a native 32bpp premultiplied BGRA buffer (IGPixelFormat.Bgra8Unorm)
- Allocates pixel buffers with
NativeMemory.Allocand releases them in a thread-safeFreePixelBuffer - Honors the host-supplied opaque cancellation token at coarse boundaries
- Leaves the animation entry points null (static images only)
Unlike a format-specific codec, the heavy lifting is delegated to SkiaSharp (the SDK's only dependency), so the plugin stays tiny and works on any platform SkiaSharp supports.
dotnet publish samples/Base64Codec/Base64Codec.csproj `
-c Release -r win-x64 -p:Platform=x64 `
-o samples/Base64Codec/bin/publish/win-x64This produces Base64Codec.dll next to igplugin.json. (Use -r linux-x64 /
-r osx-arm64 and the matching -p:Platform for other targets.)
Copy the published folder (containing the DLL, igplugin.json, and the native
libSkiaSharp asset emitted by the AOT publish) into the host's plugins dir:
%LOCALAPPDATA%\ImageGlass_10\_plugins\Base64Codec\
Base64Codec.dll
igplugin.json
libSkiaSharp.dll
On next launch the host discovers the manifest, loads the DLL, calls
ig_plugin_get_api, and registers plugin.base64.codec for .b64.
Create a test file from any image:
[Convert]::ToBase64String([IO.File]::ReadAllBytes("photo.png")) `
| Set-Content -NoNewline test.b64Open test.b64 in ImageGlass — it renders as the original image.
igplugin.json is deserialized into ImageGlass.SDK.Plugins.PluginManifest.
Required fields: id, name, executable. The kind field defaults to
"Codec" if omitted.
- Codec selection is priority-based. No built-in codec claims
.b64, but the plugin still advertisesmetadataPriority/decodePriorityof 200 so it reliably wins selection for that extension. Convert.FromBase64Stringignores embedded whitespace, so wrapped/multi-line base64 files work without pre-processing.- The codec reports
IGColorSpace.Srgb; it does not extract embedded ICC profiles (SupportsColorProfiles = 0).