Hi guys, Ä° have mcbstm32c kit, it has 320x240 lcd i am using keil sample projects. i need to convert bitmaps to c file.Which converter does keil use to create c header file.I found some converters but they didnt work with keil's sample projects and with them i couldnt see the right image
hey mehmet mate. look in the tool directery. i use graphic2h converter.
Hi Shamak; I couldnt find tool directory,i looked into C:\Keil... in my pc but there is not a directory named tool. where is this directory?
Thanks for your helping...
You should first convert picture to 16 bits per pixel, and then convert such a picture to constant array of bytes.
while(1)
i changed the image to 16 bit per pixel bitmap with a converter, and i used bitmap to c array converter, but in my lcd the images still is not true,i think i must use 16 bit per pixel c array converter like image to 16 bit per pixel bitmap converter
There is one more thing that you must do, after converting bitmap to 16 bits per pixel, you have to remove header of bitmap file, meaning you have to calculate width of picture * height * 2(bytes) and that much bytes form end of the file have to be left when you remove header. After that convert it to array, and it should work.
Why would you specifically want to create a header file?
@milorad 1. step: convert the image to a bitmap image includes 16 bits per pixel 2. step: create the c array
you said to remove the header of the converted file.but i coulnt understand after which step i mentioned above. after 1 step or after 2. step?
for example i have an 32*32=1024 size image 1: i converted it to bitmap 16 bits per pixel 2: i converted bitmap 16 bpp to c array
the result is:
const unsigned char nj[2048] = { 0x00,0x00,0x00,0x00....... }
if you want to say remove the header after second step there is no extra; because width * height * 2(bytes)=32*32*2=2048 if you want to say after 1. step how ca i remove the header from a 16 bpp image
@Andy When i am looking the samples the images, they were converted to header files, If you know another way to show images in lcd, it will be pleasure to learn for me.
Normally (ie, excluding Cpt Vince), header files are used for declarations only - to allow symbols to be shared betwen multiple source files.
Variable definitions are usually best kept in source files - otherwise you are liable to get errors due to multiple definitions.
See: c-faq.com/.../decldef.html
@Andy Yes you are true, if we use the right terms.when i create the bitmap to array it is also xxx.c file, not xxx.h file.But we are using a name to this xxx.c file header file. We already know that this isnt a xxx.h file
It is not important if it is .h or .c file, who cares. Although .c is more appropriate.
Anyways, how did you create image if you have 32 * 32 size without header?
The way it should be done is create bitmap as .bmp file, and remove header as .bmp file surely has a header and then convert it to array.
just to add unnecessary confusion!