cancel
Showing results for 
Search instead for 
Did you mean: 

what software was used to convert image to HEX

MNapi
Senior II

I tried just almost anything the best I get some black shape of a red button I ma trying to display. here is a top of the code from the "h"file. Does anybody recognize it. What converter to use ?

This is the original "h" file made by ST for their demo programs.

#ifndef __IMAGE_320x240_ARGB8888_H

#define __IMAGE_320x240_ARGB8888_H

#ifdef __cplusplus

extern "C" {

#endif

/* Includes ------------------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/

/* Exported constants --------------------------------------------------------*/

/* Exported macro ------------------------------------------------------------*/

/* Exported functions ------------------------------------------------------- */

const uint32_t image_320x240_argb8888[76800] =

{

0xFF254888,

0xFF254888,

0xFF254888,

0xFF264989,

0xFF264989,

16 REPLIES 16
Mike_ST
ST Employee

I would use XnView & HxD:

  • Open your image
  • Menu: Image->32bits
  • Save as "RAW" format and before click "Save" you have to click "option" and set "ARGB".
  • Open HxD
  • Open the raw image
  • Export as C file.

It should do the trick.

do you mean this program https://www.xnview.com/en/

I do not see the option to choose 32 bit but you can save raw data in ARGB

there is no Menu: Image->32bits

I do not know what you mean by HxD

I am not sure if I read your instructions right.

Mike_ST
ST Employee

Yes Xnview image viewer.

HxD: https://mh-nexus.de/en/hxd/

32 bits pixel mode should be activated as per following image, I set it to set 0xFF as default alpha value, or you'll get 0 as default, I think.

0693W000003PjUXQA0.png

you must have older version this option is not available in 2.49.3, there is nothing in options, properties, view to add extra tool bar

0693W000003Png3QAC.jpg

Mike_ST
ST Employee

It is because you have not opened an image in the editor, you are showing the browser.

You have to click File=>Open and select a picture, or select one on the left in the browser.

The 32bits option appears only when a picture is opened.

I did as instructed, I did the 32 bit image, then I open raw image in HxD export as C, and this is what i get

unsigned char rawData[31000] = {

   0xFF, 0xFF, 0xF1, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFD, 0xFF, 0xFE,

   0xFF, 0xFC, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFE, 0xFB,

   0xFF, 0xFF, 0xFD, 0xFE, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xF7, 0xF8, 0xFD,

it does not look like the from ST. the ST looks like 32 bit

const uint32_t image_320x240_argb8888[76800] =

{

0xFF254888,

0xFF254888,

0xFF254888,

0xFF264989,

0xFF264989,

0693W000003PthRQAS.jpg

0693W000003Ptf1QAC.jpg

this is the code from ST examples I am trying to use,

CopyBuffer((uint32_t *)image_data_red_button, (uint32_t *)LAYER0_ADDRESS, 240, 160, 155, 50);

but maybe we can try to get this one working instead

BSP_LCD_DrawBitmap(240, 160, (uint8_t *)image_data_red_button);

SP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)

whatever I try to convert the image, nothing works

The best I am getting is black button, I cannot get color red.

I follow your instruction I get this code

[31000] = {

   0xFF, 0xFF, 0xF1, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFD, 0xFF, 0xFE,

   0xFF, 0xFC, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFE, 0xFB,

   0xFF, 0xFF, 0xFD, 0xFE, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xF7, 0xF8, 0xFD,

I replace the original ST code with it

I use

CopyBuffer((uint32_t *)image_data_red_button, (uint32_t *)LAYER0_ADDRESS, 240, 160, 155, 50);

to dispaly and I get black button ,no color.

Mike_ST
ST Employee

Ok, HxD doesn't output 32 bits format text, only 8bits. I thought it could do that.

I suggest to write a small C program to open the raw file and output 32bits text,

and copy result in the array.