BMP-to-CFAG(320x240) Converter Software
Tonight I wrote a tool to output an unsigned char array from a 320x240 1-bit-per-pixel bitmap file. The unsigned char array is for use by "C" programmers and could easily be adapted/converted to other languages. Hopefully somebody will find this tool useful (the tool is attached to this thread).
Here is text from the README:
-------------------
This tool will convert a bitmap to a "C" compatible unsigned char
array which can be fed byte-by-byte to a CFAG320240CX graphics display.
This tool has some contraints:
- THIS TOOL WILL ONLY CONVERT BITMAPS WITH 1 BPP (Bit-Per-Pixel)
- THIS TOOL HAS ONLY BEEN TESTED ON BITMAPS OF SIZE 320x240
Instructions:
1) Open mspaint.exe
2) Click on 'Image'->'Attributes' (Observe new dialog open)
3) Enter 320 for the 'Width' textbox
4) Enter 240 for the 'Height' textbox
5) Select the 'Black and White' radio buttin in the 'Colors' section
6) Click on 'OK'
7) A dialog may appear warning about color loss. Click 'Yes'.
8) Paint yourself a spash image
9) Click on 'File'->'SaveAs' (Observe new dialog open)
10) Change the 'Save as type' to 'Monochrome Bitmap (*.bmp;*.dib)'
11) Save the file to a temporary location (example: c:\test\test.bmp)
12) Close mspaint.exe
13) Run bitmap2cfag.exe on the file as follows:
C:\test> bitmap2cfag test.bmp > splash.h
Depending on the version of bitmap2cfag.exe you are running, the
contents of splash.h will look similar to the following:
/* ---- FILE STATS ---- */
/* Width is: 320 */
/* Heigth is: 240 */
/* BPP is: 1 bits-per-pixel */
/*---- CODE ----*/
unsigned char Splash[240][40] =
{
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" },
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
...
...and so on...
Tonight I wrote a tool to output an unsigned char array from a 320x240 1-bit-per-pixel bitmap file. The unsigned char array is for use by "C" programmers and could easily be adapted/converted to other languages. Hopefully somebody will find this tool useful (the tool is attached to this thread).
Here is text from the README:
-------------------
This tool will convert a bitmap to a "C" compatible unsigned char
array which can be fed byte-by-byte to a CFAG320240CX graphics display.
This tool has some contraints:
- THIS TOOL WILL ONLY CONVERT BITMAPS WITH 1 BPP (Bit-Per-Pixel)
- THIS TOOL HAS ONLY BEEN TESTED ON BITMAPS OF SIZE 320x240
Instructions:
1) Open mspaint.exe
2) Click on 'Image'->'Attributes' (Observe new dialog open)
3) Enter 320 for the 'Width' textbox
4) Enter 240 for the 'Height' textbox
5) Select the 'Black and White' radio buttin in the 'Colors' section
6) Click on 'OK'
7) A dialog may appear warning about color loss. Click 'Yes'.
8) Paint yourself a spash image
9) Click on 'File'->'SaveAs' (Observe new dialog open)
10) Change the 'Save as type' to 'Monochrome Bitmap (*.bmp;*.dib)'
11) Save the file to a temporary location (example: c:\test\test.bmp)
12) Close mspaint.exe
13) Run bitmap2cfag.exe on the file as follows:
C:\test> bitmap2cfag test.bmp > splash.h
Depending on the version of bitmap2cfag.exe you are running, the
contents of splash.h will look similar to the following:
/* ---- FILE STATS ---- */
/* Width is: 320 */
/* Heigth is: 240 */
/* BPP is: 1 bits-per-pixel */
/*---- CODE ----*/
unsigned char Splash[240][40] =
{
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" },
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
{ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
...
...and so on...
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Attachments
-
33.4 KB Views: 726
Last edited: