ToChars - Online Tool For Converting Spritesheets To Character Codes

ToChars

Link: http://www.crait.net/tochars/index.php

ToChars is an online tool that I made for converting spritesheets into character code that you can use with the Arduboy. By default, it outputs into hexadecimal, but you can output data to binary and format it several ways.

A few other tools I’ve seen members make on the forum (Ex: Here and here) either handled entire images or were primarily useful for editing bitmaps, which is not what I need for a game I am working on. My tool actually rips the sprites out of the images, then converts them to code individually, then spits all the code out to you.

Because it does converts into this format, you can save room and speed in your Arduboy programs by pointing to a location in memory to draw the image instead of ripping the sprite from a large bitmap, which is a mistake that a lot of programmers accidentally fall into.


Quick Tutorial

Let’s say that you have a map made from the following 8x8 tiles. I need to have a spritesheet with those tiles that is black/white and regularly-spaced.

Now, you would be able to upload this PNG to ToChars with pretty much the default parameters. Remember that the tiles are 8px by 8px, so, we’ll put that in. Also, remember that there is no padding or offset in this since all the tiles are touching. (If you need more help with what this means, lemme know.) Leave the prefix/postfix fields on their default values and click Convert. The code should be spit out into Arduboy-compatible hexadecimal:

0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x78, 0x78, 0x07, 0x87, 0xff, 0xff, 0xe6, 0x66, 0x7f, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0xf9, 0xf9, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0x99, 0x99, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x7f, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0x99, 0x99, 0xff, 0xff, 0x98, 0x18, 0x7f, 0xff, 0xe6, 0x66, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0x99, 0x99, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0xfe, 0x7e, 0x61, 0xe1, 0x99, 0x99, 0x81, 0x81, 0xff, 0xff, 0xf9, 0xf9, 0x9f, 0x9f, 0xff, 0xff, 0xf8, 0x78, 0x06, 0x06, 0x61, 0xe1, 0x86, 0x06, 0x7f, 0xff, 0x81, 0x81, 0xe6, 0x66, 0x78, 0x78, 0x78, 0x78, 0x07, 0x87, 0xff, 0xff, 0xe6, 0x66, 0x7f, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0xf9, 0xf9, 0xf9, 0xf9, 0xff, 0xff, 0x81, 0x81, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0xf8, 0x78, 0x7f, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xf9, 0xf9, 0xe1, 0xe1, 0x99, 0x99, 0x99, 0x99, 0xe7, 0xe7, 0xff, 0xff, 0xe1, 0xe1, 0xe6, 0x66, 0x79, 0xf9, 0x87, 0x87, 0x98, 0x18, 0x61, 0xe1, 0xe6, 0x66, 0x7f, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0x99, 0x99, 0xff, 0xff, 0x98, 0x18, 0x7f, 0xff, 0xe6, 0x66, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0x78, 0x7f, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x81, 0x81, 0xff, 0xff, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x80, 0x00, 0x79, 0xf9, 0xe7, 0xe7, 0x80, 0x00, 0x00, 0x00, 0x67, 0xe7, 0x80, 0x00, 0x07, 0x87, 0x86, 0x06, 0x00, 0x00, 0x61, 0xe1, 0xe6, 0x66, 0x00, 0x00, 0x66, 0x66, 0x19, 0x99, 0xe6, 0x66, 0x00, 0x00, 0x7f, 0xff, 0x9e, 0x1e, 0x78, 0x78, 0x00, 0x00, 0x79, 0xf9, 0xe7, 0xe7, 0x86, 0x06, 0x00, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x67, 0xe7, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x67, 0xe7, 0xf8, 0x78, 0x67, 0xe7, 0xe7, 0xe7, 0xf9, 0xf9, 0x80, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x1e, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x67, 0xe7, 0xe6, 0x66, 0x79, 0xf9, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x61, 0xe1, 0x9e, 0x1e, 0x1e, 0x1e, 0x1f, 0x9f, 0x80, 0x00, 0x67, 0xe7, 0x80, 0x00, 0x78, 0x78, 0x7e, 0x7e, 0x78, 0x78, 0x61, 0xe1, 0xe6, 0x66, 0x00, 0x00, 0x66, 0x66, 0x19, 0x99, 0xe6, 0x66, 0x79, 0xf9, 0xe6, 0x66, 0x66, 0x66, 0x61, 0xe1, 0xf8, 0x78, 0x61, 0xe1, 0xe7, 0xe7, 0xe6, 0x66, 0x1e, 0x1e, 0x79, 0xf9, 0x87, 0x87, 0xe7, 0xe7, 0x80, 0x00, 0x67, 0xe7, 0xf8, 0x78, 0x78, 0x78, 0x1f, 0x9f, 0xe0, 0x60, 0x1f, 0x9f, 0x9e, 0x1e, 0x00, 0x00, 0x67, 0xe7, 0xf9, 0xf9, 0x80, 0x00, 0x67, 0xe7, 0xe7, 0xe7, 0xf9, 0xf9, 0xfe, 0x7e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff, 0xfe, 0x7e, 0x67, 0xe7, 0xff, 0xff, 0xe7, 0xe7, 0xe6, 0x66, 0x61, 0xe1, 0x98, 0x18, 0x07, 0x87, 0xe7, 0xe7, 0x99, 0x99, 0xfe, 0x7e, 0x7f, 0xff, 0xf8, 0x78, 0x67, 0xe7, 0x80, 0x00, 0x00, 0x00, 0x67, 0xe7, 0x80, 0x00, 0x78, 0x78, 0x60, 0x60, 0x18, 0x18, 0x01, 0x81, 0xf8, 0x78, 0x1f, 0x9f, 0x87, 0x87, 0xe1, 0xe1, 0xe6, 0x66, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x66, 0x66, 0x00, 0x00, 0x7f, 0xff, 0x9e, 0x1e, 0x78, 0x78, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x07, 0x87, 0xf9, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0xe7, 0xf8, 0x78, 0x00, 0x00, 0x60, 0x60, 0x19, 0x99, 0xf8, 0x78, 0x01, 0x81, 0xf9, 0xf9, 0xf8, 0x78, 0x67, 0xe7, 0x9f, 0x9f, 0x98, 0x18, 0x06, 0x06, 0x7f, 0xff, 0xff, 0xff, 0x9e, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x79, 0xf9, 0x87, 0x87, 0xf8, 0x78, 0x79, 0xf9, 0xe6, 0x66, 0x61, 0xe1, 0x86, 0x06, 0x78, 0x78, 0x01, 0x81, 0xe1, 0xe1, 0xf8, 0x78, 0x61, 0xe1, 0x86, 0x06, 0x19, 0x99, 0xff, 0xff, 0x9f, 0x9f, 0x80, 0x00, 0x18, 0x18, 0x78, 0x78, 0x67, 0xe7, 0xf9, 0xf9, 0xe0, 0x60, 0x7f, 0xff, 0x9e, 0x1e, 0x60, 0x60, 0x7e, 0x7e, 0x18, 0x18, 0x66, 0x66, 0x1f, 0x9f, 0x9f, 0x9f, 0x87, 0x87, 0xf9, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x78, 0x78, 0x7e, 0x7e, 0x7f, 0xff, 0xfe, 0x7e, 0x01, 0x81, 0x98, 0x18, 0x06, 0x06, 0x1f, 0x9f, 0x9f, 0x9f, 0xe7, 0xe7, 0xf8, 0x78, 0x06, 0x06, 0x00, 0x00, 0x1f, 0x9f, 0xff, 0xff, 0x99, 0x99, 0xe6, 0x66, 0x19, 0x99, 0xe0, 0x60, 0x78, 0x78, 0x7e, 0x7e, 0x01, 0x81, 0xff, 0xff, 0x9f, 0x9f, 0x9f, 0x9f, 0xe6, 0x66, 0x78, 0x78, 0x7e, 0x7e, 0x00, 0x00, 0x79, 0xf9, 0x87, 0x87, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xf9, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xfe, 0x7e, 0x79, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x81, 0x81, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0xf8, 0x78, 0x7f, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7e, 0x79, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xe7, 0xe7, 0xf9, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x78, 0x7f, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x81, 0x81, 0xff, 0xff, 0xe0, 0x60, 0x19, 0x99, 0x80, 0x00, 0x60, 0x60, 0x07, 0x87, 0x80, 0x00, 0x06, 0x06, 0x1f, 0x9f, 0x81, 0x81, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0xf8, 0x78, 0x7f, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x67, 0xe7, 0xf9, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xfe, 0x7e, 0x79, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xe0, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x07, 0x87, 0xe0, 0x60, 0x06, 0x06, 0x1f, 0x9f, 0xf8, 0x78, 0x7f, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x81, 0x81, 0xff, 0xff, 0xf9, 0xf9, 0xff, 0xff, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x7e, 0x7e, 0x79, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xe7, 0xe7, 0xf9, 0xf9, 0xff, 0xff, 0xf9, 0xf9, 0xfe, 0x7e, 0x79, 0xf9, 0xe1, 0xe1, 0x86, 0x06, 0x07, 0x87, 0xf9, 0xf9, 0x81, 0x81, 0xf9, 0xf9, 0x81, 0x81, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf8, 0x78, 0x79, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf8, 0x78, 0x07, 0x87, 0xff, 0xff, 0xe6, 0x66, 0x7f, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0xf9, 0xf9, 0x9f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0xe6, 0x66, 0x79, 0xf9, 0xfe, 0x7e, 0x61, 0xe1, 0x99, 0x99, 0x99, 0x99, 0x87, 0x87, 0xf8, 0x78, 0x79, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0x81, 0x81, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xff, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0x99, 0x99, 0xff, 0xff, 0x98, 0x18, 0x7f, 0xff, 0xe6, 0x66, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x1f, 0x9f, 0xf9, 0xf9, 0xe7, 0xe7, 0xfe, 0x7e, 0x19, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x99, 0x99, 0x99, 0x99, 0x98, 0x18, 0x19, 0x99, 0x99, 0x99, 0x98, 0x18, 0x19, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x81, 0x81, 0x99, 0x99, 0x86, 0x06, 0x06, 0x06, 0x19, 0x99, 0xe0, 0x60, 0x01, 0x81, 0x86, 0x06, 0x78, 0x78, 0x60, 0x60, 0x01, 0x81, 0x98, 0x18, 0x19, 0x99, 0x81, 0x81, 0x98, 0x18, 0x19, 0x99, 0x81, 0x81, 0x98, 0x18, 0x07, 0x87, 0x81, 0x81, 0x80, 0x00, 0x79, 0xf9, 0xfe, 0x7e, 0x61, 0xe1, 0x87, 0x87, 0x9f, 0x9f, 0xe0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x61, 0xe1, 0x9e, 0x1e, 0x19, 0x99, 0xe1, 0xe1, 0x80, 0x00, 0x00, 0x00, 0x18, 0x18, 0x01, 0x81, 0x98, 0x18, 0x19, 0x99, 0x99, 0x99, 0x81, 0x81, 0x98, 0x18, 0x01, 0x81, 0xf9, 0xf9, 0x80, 0x00, 0x01, 0x81, 0x87, 0x87, 0x81, 0x81, 0x81, 0x81, 0xe1, 0xe1, 0xfe, 0x7e, 0x7f, 0xff, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x79, 0xf9, 0x9e, 0x1e, 0x79, 0xf9, 0x87, 0x87, 0x9e, 0x1e, 0x61, 0xe1, 0x80, 0x00, 0x00, 0x00, 0x61, 0xe1, 0x98, 0x18, 0x61, 0xe1, 0x98, 0x18, 0x00, 0x00, 0x19, 0x99, 0x81, 0x81, 0x98, 0x18, 0x67, 0xe7, 0xff, 0xff, 0xfe, 0x7e, 0x1e, 0x1e, 0x78, 0x78, 0x07, 0x87, 0x87, 0x87, 0x87, 0x87, 0xfe, 0x7e, 0x60, 0x60, 0x78, 0x78, 0x60, 0x60, 0x7f, 0xff, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x19, 0x99, 0xfe, 0x7e, 0x19, 0x99, 0x86, 0x06, 0x01, 0x81, 0xe6, 0x66, 0x18, 0x18, 0x18, 0x18, 0x61, 0xe1, 0x99, 0x99, 0xe0, 0x60, 0x19, 0x99, 0x99, 0x99, 0x81, 0x81, 0x98, 0x18, 0x19, 0x99, 0xfe, 0x7e, 0x7e, 0x7e, 0x79, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0x86, 0x06, 0x78, 0x78, 0x7f, 0xff, 0xe0, 0x60, 0x78, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x06, 0x06, 0x06, 0x06, 0x19, 0x99, 0xe0, 0x60, 0x06, 0x06, 0x01, 0x81, 0xf9, 0xf9, 0xe6, 0x66, 0x07, 0x87, 0xe0, 0x60, 0x67, 0xe7, 0x87, 0x87, 0x80, 0x00, 0x1e, 0x1e, 0x1e, 0x1e, 0x00, 0x00, 0x07, 0x87, 0x81, 0x81, 0x80, 0x00, 0x79, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0xfe, 0x7e, 0x07, 0x87, 0x98, 0x18, 0x06, 0x06, 0x07, 0x87, 0xfe, 0x7e, 0x06, 0x06, 0x78, 0x78, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x61, 0xe1, 0x9e, 0x1e, 0x19, 0x99, 0xe1, 0xe1, 0x86, 0x06, 0x01, 0x81, 0xe0, 0x60, 0x67, 0xe7, 0x87, 0x87, 0xe0, 0x60, 0x1e, 0x1e, 0x1e, 0x1e, 0x00, 0x00, 0x1e, 0x1e, 0x79, 0xf9, 0x80, 0x00, 0x01, 0x81, 0x87, 0x87, 0xfe, 0x7e, 0x01, 0x81, 0xff, 0xff, 0xff, 0xff, 0x86, 0x06, 0x18, 0x18, 0x07, 0x87, 0x99, 0x99, 0xf8, 0x78, 0x06, 0x06, 0x7e, 0x7e, 0x7e, 0x7e, 0x67, 0xe7, 0x86, 0x06, 0x60, 0x60, 0x78, 0x78, 0x07, 0x87, 0x9f, 0x9f, 0x80, 0x00, 0x7e, 0x7e, 0x07, 0x87, 0x98, 0x18, 0x66, 0x66, 0x1f, 0x9f, 0x86, 0x06, 0x78, 0x78, 0x7e, 0x7e, 0x18, 0x18, 0x78, 0x78, 0x67, 0xe7, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff, 0x9f, 0x9f, 0x81, 0x81, 0x9e, 0x1e, 0x07, 0x87, 0x98, 0x18, 0x66, 0x66, 0x1f, 0x9f, 0x86, 0x06, 0x78, 0x78, 0x7e, 0x7e, 0x18, 0x18, 0x60, 0x60, 0x06, 0x06, 0x07, 0x87, 0xe1, 0xe1, 0x80, 0x00, 0x1f, 0x9f, 0x87, 0x87, 0xff, 0xff, 0x99, 0x99, 0x99, 0x99, 0xe0, 0x60, 0x7f, 0xff, 0xe6, 0x66, 0x18, 0x18, 0x66, 0x66, 0x78, 0x78, 0x1f, 0x9f, 0x9e, 0x1e, 0x66, 0x66, 0x78, 0x78, 0x1e, 0x1e, 0x01, 0x81, 0x9f, 0x9f, 0xff, 0xff, 0x99, 0x99, 0x99, 0x99, 0xe0, 0x60, 0x7f, 0xff, 0xe6, 0x66, 0x18, 0x18, 0x66, 0x66, 0x78, 0x78, 
2 Likes

A bit like, https://github.com/yyyc514/img2ard, no? Oh except I don’t assume any specific size of sprites, although if we’re talking about 8x8 since the page size is 8 pixels high then it will actually “just work” exactly as the drawing illustrates (one strip of 8 pixels at a time).

Well, this is more functional than just converting a folder full of images… As I said, my tool actually rips the sprites out of a single image, meaning you can have a single sheet of sprites with any size sprites, any padding, any offset, and output in several formats. (The output is especially useful when writing the program for different platforms.)

1 Like

Not sure what you’re talking about here… obviously the right way to draw sprites is directly from flash… not sure what you mean by “ripping from a large bitmap”.

Well, mine was purposely geared towards Arduboy. :slight_smile: So I don’t care about “other formats”… though it does also output my crazy fast interleaved image/mask format for use with ArduboyExtra. Yes mine does a full folder but any of the files in that folder could be a single large sheet of sprites and then you could address it dynamically the same way you’d address any large image, unless I’m missing something. Mine was designed to let the programmer choose what is easiest for them.

Ah the “set parameters” may be your bit of magic mojo. :slight_smile: That would allow you to do something a little more specific with a large image.

:wink: Yep! A lot of spritesheets have padding or offsets in them for various reasons. I wanted to make sure my tool accommodated those properly.

A lot of people make the simple mistake of converting a large spritesheet into a large array as if it was one large image. Then, they have all their data out of order, so they on-the-fly grab the rest of the sprite from all over that array. To you and I, the most obvious place to put a sprite’s data is all together, but many tools don’t care about keeping sprites together… They simple put the array in the order that the pixels appear. :slight_smile:

Yeah! It’s all about making sure people have more choices when making their programs. :smiley:

1 Like

This is the first game I have ever tried to develop as I am actually a kernel/system’s programmer so this is a bit of a stretch for me. Please excuse any ignorance :slight_smile:

I think I found a bug in the ToChars site, but need someone to confirm or let me know what I am doing wrong. I created a PNG that contains 6 different sprites (12 x 14 px). When I make the image 1 row with 6 sprites, the resulting array seems correct, but when I orient the sprites in 2 rows of 3 each (), I seem to get artifacts. I examined the resulting array and sure enough they are different, but I don’t know why.

When using the site, I supplied the same sprite dimensions and since the other settings are unknown to me I am at a loss for how to debug the situation.

The code to print out the result is below and prints properly when the 1 x 6 array is used, but with artifacts when using the 2 x 3.
// jo_w = 12 // jo_h = 14 arduboy.drawBitmap(2, 2, bmp + (24 * 0), 12, 14, WHITE); arduboy.drawBitmap(2 + jo_w, 2, bmp + (24 * 1), 12, 14, WHITE); arduboy.drawBitmap(2 + (jo_w * 2), 2, bmp + (24 * 2), 12, 14, WHITE); arduboy.drawBitmap(2, 2 + jo_h, bmp + (24 * 3), 12, 14, WHITE); arduboy.drawBitmap(2 + jo_w, 2 + jo_h, bmp + (24 * 4), 12, 14, WHITE); arduboy.drawBitmap(2 + (jo_w * 2), 2 + jo_h, bmp + (24 * 5), 12, 14, WHITE);

Was limited to 1 image to unload so adding the 1 x 6 image here:

UPDATE : I figured out the issue and I think this is a bug or how I am packing my sprite block is wrong. Basically the first row is 14 px and the image in the subsequent row is leaking into the one above instead of the bits being zeroed out it is taking the residual from the next row. I can fix the issue by padding my sprites rows to be on a 16 bit boundary but I think this is a bug and could be easily fixed in the backend.

Ah, yes! ToChars will automatically adjust the images to force it to work in bytes. This means that the image that you want to use will only be a portion of what’s in the output. I think that means that to get it to work the way you were initially uploading it, you’d have to add some offsets into your code. I think what you ended up doing would be more efficient memory-wise, anyway. :slight_smile:

Nice sprite, by the way, @arr. What kind of game are you working on??

@crait Thanks! The site is quite helpful. One suggestion, document the 8-bit boundary assumption or at least mention how to use the boundary and offsets fields. It might be obvious for veteran game developers, but it wasn’t for someone starting out :slight_smile: I am working on a top-down style game in the spirit of Zelda. I have the theme and story line hammered out, learning video game mechanics now :slight_smile:

your image converter is great but in your tutorial Make Your Own Arduboy Game: Part 6 - Graphics!!, you only show how to use one whole png as one sprite. but how do we use one out of a large spritesheet which has more than one?

2 Likes

These comments might help:

3 Likes