BMP2c.exe

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

BMP2c.exe

12,233 次查看
serene
Contributor I
Hi all,
 Does anyone know from where shall i  download the BMP2C v1.1 exe.It is a freeware from freescale only.I need that same exe to convert a bmp image to .c file.Any help is appreciated.
 Regards
     Serene
标签 (1)
0 项奖励
回复
5 回复数

1,959 次查看
CrasyCat
Specialist III
Hello
 
Just checked on FSL web page.
This utility is referenced from application note AN3415.
 
If you load the accompanying software (AN3415SW)  BMP2C is part of the zip file.
 
I hope this helps.
 
CrasyCat
0 项奖励
回复

1,959 次查看
serene
Contributor I
Hi,
 Thanks for the reply..
 But I need the exact version BMP2C V1.1 .
 
The output file will look like ...

const intbitmap_width = 240;

const intbitmap_height = 80;

Comments:smileysurprised:utput bpp: 16,Output format: RGB565

Code:

const unsigned shortbitmap_data[19200] = {

0xFFFF,

0xFFFF,

0xFFFF,

....

....etc..

}

 

 But now output is

const charImage[] = {

800, 600,    comment:Imagesize width x height (in pixel)

0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

..etc..

}

This tool is used in freescale's IMX31 bsp's display driver .I need that same tool...Or Shall i change my output file to that format?

  Regards

   Serene

 

 

0 项奖励
回复

1,959 次查看
CompilerGuru
NXP Employee
NXP Employee
Could the reason for the different pixel size not be the bmp file you are encoding?
According to MS Paint, bmp's exist at least with 1, 8, 32 bits per pixel.

Daniel

BTW:
"const char Image[] = { 800, 600," looks a bit odd. Should probably be unsigned char , that's a minor thing, but more important, 800 and 600 do not fit into any char....
0 项奖励
回复

1,959 次查看
rocco
Senior Contributor II

CompilerGuru wrote:
BTW: "const char Image[] = { 800, 600," looks a bit odd.
I would bet that it is meant to be:

const char Image[800][600];
0 项奖励
回复

1,959 次查看
serene
Contributor I
Hi all,
  I got the solution for the problem.I have written a program which converts 24 bit bmp data to RGB 565 format.24 bit bmp contains data in the format (RGB-8 bits for representing each color).RGB 565 format contains first 5 bits of RED, first 6 bits of GREEN, first 5 bits of BLUE.So we need to get the desired information out of these 24 bits. 
Will explain the steps...
1.Open the 24 bit bmp file in text pad or any hex editor...
2.Remove the bmp header
3.Copy the pixel information to an array of the following format
4.Use the below code
 
Code:
unsigned char MyBMPData[ ] ={, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff etc.......}; #include<stdio.h>#include<stdlib.h>typedef unsigned short WORD;#define RGB_TO_565(r, g, b) (WORD) ((r & 0xf8 )<<8) | ((g&0xfc)<<3) | ((b&0xf8)>>3)void main(){ FILE *fp; int length = sizeof(MyBMPData)/sizeof(unsigned char ); printf("\n%d\n", length); int logoLength= length/3; printf("\nx =%d\n", logoLength); unsigned short *logo; logo = (unsigned short*)malloc(logoLength*sizeof(unsigned short)); char logoBuffer[25]; fp = fopen("C://MyLogo.c","w"); // opens a file to store RGB 565 format data outpurt sprintf(logoBuffer,"MyLogo[%d] =\n { \n",logoLength); printf("%s",logoBuffer);  fprintf(fp,"%s",logoBuffer); for(int index = 0,logoIndex =0;  (index<length && logoIndex<logoLength);logoIndex++) {  logo[logoIndex] = RGB_TO_565(MyBMPData[index],MyBMPData[index+1],MyBMPData[index+2]);  index = index+3;  printf("0x%x, ", logo[logoIndex]);  fprintf(fp,"0x%x, ", logo[logoIndex]);  if((logoIndex+1)%20 ==0)  {   printf("\n");   fprintf(fp,"\n");  }   } printf("};"); fprintf(fp,"};"); fclose(fp);} /*********the output file would look like this****************/ MyLogo[19200] = {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, \
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff etc...};
  
Regards
 Serene

--
Alban formatted code to avoid smileys.


Message Edited by Alban on 2007-06-25 11:34 AM
0 项奖励
回复