acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

README.md (1292B)

      1 ## bmp2array4bit
      2 
      3 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.
      4 
      5 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.
      6 
      7 You'll need python 3.6 (the original uses Python 2.7)
      8 
      9 `usage: python bmp2array4bit.py [-v] star.bmp [-o myfile.c]`
     10 
     11 Create the bmp file in Gimp (www.gimp.org) from any image as follows:
     12 
     13 * Remove the alpha channel (if it has one)
     14         Layer -> Transparency -> Remove Alpha Channel
     15 * Set the mode to indexed.
     16         Image -> Mode -> Indexed...
     17 * Select Generate optimum palette with 16 colors (max)
     18 * Export the file with a .bmp extension. Do **NOT** select options:
     19   * Run-Length Encoded
     20   * Compatibility Options: "Do not write color space information" 
     21   * There are no Advanced Options available with these settings
     22 
     23 (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).
     24 
     25 The first array produced is the palette for the image.
     26 The second is the image itself.