/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / How to convert .bmp to .h correctly ?

Username:     
Password:     
             

Forum

# 1   2014-02-11 09:23:00 How to convert .bmp to .h correctly ?

chumak_sp
New member
Registered: 2013-12-09
Posts: 4

How to convert .bmp to .h correctly ?

I tried to use BMPConverter from Circle-OS-4.61 BMPTOLCD folder.
But my project does not compile with the .h file, received after conversion.
I tried also to convert original t1x.bmp file from downloaded DMA2D-TR-1.0 example.
The result was the same sad
Whereas with the original file t1x.h from the same DMA2D-TR-1.0  folder all works OK.
Help the beginner please!

Last edited by chumak_sp (2014-02-11 09:23:51)

Offline

 

# 2   2014-02-11 23:13:48 How to convert .bmp to .h correctly ?

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: How to convert .bmp to .h correctly ?

Hello,

Download DMA2D-Demo_1.0 project and use the file bin2h.exe found in the folder image/foreground to convert bitmap. Maybe remove header in output file (depending the include methode in your source file).

Best regards,
Pierre

Offline

 

# 3   2014-02-12 09:01:07 How to convert .bmp to .h correctly ?

Etienne.C
Administrator
Registered: 2012-12-04
Posts: 71

Re: How to convert .bmp to .h correctly ?

Hello,

We provide a specific application for converting BMP file to header files, in order to include it into CircleOS application, at resources page.
Take a loot at :
http://www.stm32circle.com/projects/project.php?id=129

Rgds

Offline

 

# 4   2014-02-12 10:41:42 How to convert .bmp to .h correctly ?

chumak_sp
New member
Registered: 2013-12-09
Posts: 4

Re: How to convert .bmp to .h correctly ?

$1,
thanks a lot, bro!
Bin2h utility seems to be working correctly, except  needed to  remove a couple of lines manually:

Code:

unsigned int t1x_size=308278;
unsigned char t1x[] = {
0x42,0x4d,0x36,0xb4,0x04,0x00,0x00,0x00,0x00,0x00,0x36,0x04,0x00,0x00,0x28,
0x00,0x00,0x00,0x80,0x02,0x00,0x00,0xe0,0x01,0x00,0x00,0x01,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0xb0,0x04,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x0c,0x00,0x0c,0x16,
0x11,0x00,0x07,0x18,0x11,0x00,0x0e,0x1c,0x18,0x00,0x28,0x1e,0x11,0x00,0x19,
0x1d,0x1c,0x00,0x1e,0x21,0x13,0x00,0x0d,0x21,0x19,0x00,0x19,0x22,0x1a,0x00,
..................

Here is a workihg t1x.h. It looks like this:

Code:

0x42,0x4d,0x36,0xb4,0x04,0x00,0x00,0x00,0x00,0x00,0x36,0x04,0x00,0x00,0x28,
0x00,0x00,0x00,0x80,0x02,0x00,0x00,0xe0,0x01,0x00,0x00,0x01,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0xb0,0x04,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x0c,0x00,0x0c,0x16,
0x11,0x00,0x07,0x18,0x11,0x00,0x0e,0x1c,0x18,0x00,0x28,0x1e,0x11,0x00,0x19,
0x1d,0x1c,0x00,0x1e,0x21,0x13,0x00,0x0d,0x21,0x19,0x00,0x19,0x22,0x1a,0x00,
............

$1
I'm very sorry, but precisely this utility (http://www.stm32circle.com/projects/project.php?id=129) does not work properly.
Please look at piece of converted file:

Code:

0x424D, 0x36B4, 0x0400, 0x0000, 0x0000, 0x3604, 0x0000, 0x2800, 
0x0000, 0x8002, 0x0000, 0xE001, 0x0000, 0x0100, 0x0800, 0x0000, 
0x0000, 0x00B0, 0x0400, 0x130B, 0x0000, 0x130B, 0x0000, 0x0001, 
0x0000, 0x0001, 0x0000, 0x1011, 0x0C00, 0x0C16, 0x1100, 0x0718, 
0x1100, 0x0E1C, 0x1800, 0x281E, 0x1100, 0x191D, 0x1C00, 0x1E21, 
..................

It is visibly, that received array consists of type $1 constants.
But, as I understand, we need  the type $1 ones...

So, I slightly remade the utility from page http://www.stm32circle.com/projects/project.php?id=129
In my opinion now it is correct.
Is it possible somehow to attach it here?

Last edited by chumak_sp (2014-02-12 10:51:31)

Offline

 

# 5   2014-02-12 14:22:35 How to convert .bmp to .h correctly ?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: How to convert .bmp to .h correctly ?

Chumak_sp,

The BMPTOLCD was developed for first LCD primers, as raw data in RGB565 format.

The BMP Converter that told Etienne allows to convert BMP files (RLE compressed or not) into format compatible with current "normal" API functions (DRAW_SetImage...), in order to display bitmaps or icons on the LCD, with also 16 bits RGB565 format.

But, for DMA2D functions, the bitmap file must be taken "as is", with no conversion. So, the simplest way is to use the bin2hex tool as Pierre said.

Note that the supported format are: 4, 8, 16 (RGB565 format), and 32bits (A888 format) color length, with or without color palette.

You can get a useful tool here pngtobmp32.codeplex.com for converting png images to 32 bits bmp, which support transparency.

Offline

 

# 6   2014-02-13 07:43:07 How to convert .bmp to .h correctly ?

chumak_sp
New member
Registered: 2013-12-09
Posts: 4

Re: How to convert .bmp to .h correctly ?

Thanks for the explanation smile

Offline

 

Board footer