Unverified Commit 110128b0 authored by Kate Morris's avatar Kate Morris Committed by GitHub

updated with formatting and links

parent 3a215780
## bmp2array4bit
bmp2array4bit.py creates C (or C++) code that contains two arrays for adding images to four-bit sprites. See Sprite_image_4bit for an example. bmp2array4bit.py reads a bmp file, and creates C (or C++) code that contains two arrays for adding images to four-bit sprites. See [Sprite_image_4bit](../../examples/Sprite/Sprite_image_4bit) for an example.
It is loosely based on Spark Fun's bmp2array script. It is loosely based on Spark Fun's bmp2array script, https://github.com/sparkfun/BMPtoArray/blob/master/bmp2array.py. The bmp file format is documented in https://en.wikipedia.org/wiki/BMP_file_format.
You'll need python 3.6 (the original use Python 2.7) You'll need python 3.6 (the original uses Python 2.7)
usage: python bmp2array4bit.py [-v] star.bmp [-o myfile.c] `usage: python bmp2array4bit.py [-v] star.bmp [-o myfile.c]`
Create the bmp file in Gimp from any image by: Create the bmp file in Gimp (www.gimp.org) from any image as follows:
. Remove the alpha channel (if it has one) * Remove the alpha channel (if it has one)
Layer -> Transparency -> Remove Alpha Channel Layer -> Transparency -> Remove Alpha Channel
. Set the mode to indexed. * Set the mode to indexed.
Image -> Mode -> Indexed... Image -> Mode -> Indexed...
. Select Generate optimum palette with 16 colors (max) * Select Generate optimum palette with 16 colors (max)
. Export the file with a .bmp extension. Do NOT select options: * Export the file with a .bmp extension. Do **NOT** select options:
. Run-Length Encoded * Run-Length Encoded
. Compatibility Options: "Do not write color space information" * Compatibility Options: "Do not write color space information"
. There are no Advanced Options available with these settings * There are no Advanced Options available with these settings
I don't have photoshop so cannot help you with that. (There are other tools that will produce bmp files, and these should work provided you don't use run-length encoding or other advanced features).
The first array produced is the palette for the image. The first array produced is the palette for the image.
The second is the image itself. The second is the image itself.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment