A minimal integrated external tool sample for ImageGlass v10.
It is a plain dotnet console app that connects back to the host through the
SDK's named-pipe channel and reacts to viewer events.
| When | What it logs |
|---|---|
The host runs the tool (OnExecuteAsync) |
Metadata of the current photo |
| The user navigates to a different photo | Metadata of the new photo |
| The user clicks in the ImageGlass viewer | RGBA value of the pixel under the click |
ImageGlass is a GUI process, so a child launched with UseShellExecute=false
inherits no console — Console.WriteLine alone would go nowhere. This sample
therefore writes every line to a log file next to the executable:
ConsoleColorPicker\bin\Debug\net10.0\ConsoleColorPicker.log
On Windows it also tries to AllocConsole so you can watch the output live in a
window. Pass --debug to additionally emit the SDK's IPC lifecycle traces to the
same log.
dotnet build .\ConsoleColorPicker.csproj -c DebugThe compiled exe lives in bin\Debug\net10.0\ConsoleColorPicker.exe.
The tool must be launched by ImageGlass — it expects a
--pipe <name>argument. Running the exe directly logs a fatal error and exits with a non-zero code.
Add an entry under Tools:
"Tools": [
{
"ToolId": "Tool_ConsoleColorPicker",
"ToolName": "Console Color Picker",
"Executable": "D:\\path\\to\\ConsoleColorPicker.exe",
"Arguments": "",
"IsIntegrated": true,
"Hotkeys": ["K"]
}
]ToolId in the config must match ConsoleColorPickerTool.ToolId in code.
IsIntegrated must be true so the host launches the process with --pipe
and wires up the HostApi proxy.
- Subclasses
ImageGlass.SDK.Tools.ToolBase. - Overrides
OnInitializedAsyncto subscribe to pointer-pressed events viaHostApi.SubscribeEventsAsync(new ToolEventSubscriptions { PointerPressed = true }). - Overrides
OnExecuteAsyncandOnPhotoChangedto callHostApi.GetPhotoMetadataAsync(). - Overrides
OnPointerPressedto callHostApi.ReadPixelAsync(x, y)using the source-image coordinates fromPointerEventArgs.SourceX/Y. - Overrides
OnShutdownAsyncto log a final message when the host disconnects.