Thanks, I hadn't noticed that it was actually saving BMP files instead of PNG. I removed Bitmap.Free to make it compatible with the rest of the code.

I finally got the code generation to work now, at least for a simple project. It does still need to be tested a lot more to make sure all commands work properly.