Simple, educational tool to transform images to the bitmap format supported by the 2024 gophercon badger-w (and therefore most TinyGo devices!).
All of the most interesting bits in the code are heavily documented in-line.
Build the tool or install it using the following:
go install github.com/taigrr/gopherbadgeimage@v1.0.0
Run it as follows to generate a profile image:
gopherbadgeimag profile image.jpg
Or, for the splash screen:
gopherbadgeimg splash image.jpg
This will result in 3 different outputs:
- In the Makefile from the badge repo, you're allowed to replace the profile image by dropping in base64-encoded pixel data. This is printed to STDOUT by default, and can be pasted directly into the Makefile.
- The generator will also create a .bin file, which can be embedded into your
code using
go:embed
. An example of this can be found inmain_test.go
. - Finally, the generator will also create a
*-generated.go
file similar to the tainigo.go file, to demonstrate an alternative to go embed.