Blake Smith

create. code. learn.

»

GBTile: A GameBoy PNG to Tile Converter

Yesterday, I published gbtile on my Github Page and on crates.io. gbtile is a small command line utility written in Rust to take PNG sprite tile images like this:

PNG Tile

And convert them to 2-bit pixels, packed into raw C arrays for use with GBDK: a C compiler for homebrew GameBoy development.

Here’s what some of the ASCII tiles from above look like in a project I’m currently working on:

Spritejar converted

The README has more details about how to use it, if you want to take a stab at doing some GameBoy homebrew. It’s easy to integrate into Makefiles, or any other command line build system.

Learning about the internals of the GameBoy has helped me appreciate what a simple computer architecture looks like. The classic DMG GameBoy is basically a handheld computer where you can actually understand everything that’s going on in the entire system. The limitations of the hardware make for good, fun programming in all its 8-bit (sort-of) z80 glory! A piece of my childhood has come back to life.

Check it out, and let me know what you think.


about the author

Blake Smith is a Principal Software Engineer at Sprout Social.