I have been using Windows for video games only for several years now. But that changed a little as I started working on Printd, Toph’s print server daemon.
An executable file (
.exe) on Windows can provide its icons. If you build a Go program for Windows you get the generic executable icon, which is fine. But sometimes fine isn’t enough.
Especially when adding an icon to a Go-built Windows executable is easy.
You need one or more icon files (
If you have a PNG file, there are online tools that you can use to convert from the PNG icon to a
If you have the ImageMagick tool handy, you can use it like so:
convert icon_16.png icon_32.png icon_48.png icon_256.png -colors 256 icon.ico
Notice how you can include several icons in a single
.ico file. It allows you to embed icons of different sizes.
Try including 16×16, 32×32, 48×48 and 256×256 icons to cover all your bases.
This step requires a special tool: github.com/akavel/rsrc
go install github.com/akavel/rsrc@latest
And use it to generate
Run this tool multiple times, once for each architecture you are targetting.
It will create a new
.syso file every time. Store these files inside your
Yes. In step 3, you only need to build the Go program.
Go will automatically pick any relevant
.syso file in the
main package directory and include that in the executable built for Windows.
comments powered by Disqus