Skip to main content
MNapi
Senior II
August 18, 2020
Question

what software was used to convert image to HEX

  • August 18, 2020
  • 16 replies
  • 6423 views

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,

This topic has been closed for replies.

16 replies

Mike_ST
ST Technical Moderator
August 18, 2020

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
MNapi
MNapiAuthor
Senior II
August 18, 2020

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 Technical Moderator
August 19, 2020

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
MNapi
MNapiAuthor
Senior II
August 19, 2020

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 Technical Moderator
August 20, 2020

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
MNapi
MNapiAuthor
Senior II
August 20, 2020

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

Mike_ST
ST Technical Moderator
August 24, 2020

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
MNapi
MNapiAuthor
Senior II
August 24, 2020

After spending a few days researching I found this program Bitmap Converter (ST) for emWin V5.32 in comes from ST in this package STemWin_Library_V1.2.0

I have to do the Alpha (I choose for image 1 and 2 the same blue button) like on the picture then I get 32 bit ARGB format like this one

{

0xFF254888,

0xFF254888,

0xFF254888,

0xFF264989,

0xFF264989,

and it finally worked with this code CopyBuffer((uint32_t *)blue_button, (uint32_t *)LAYER0_ADDRESS, 240, 160, 155, 50);

I only have to create bitmat image in photoshop first and then open with this program and save as C file and all the 32 bit code is inside.

0693W000003Q97ZQAS.jpg

HP_it
Senior II
August 24, 2020

There is a (very vague) reference to a program called LCD image converter in one of the applications notes on how to set up the LTDC interface with an LCD display.

Some time ago I made a video on this procedure: https://www.youtube.com/watch?v=GxUpMrnIwpo

Look at around 32:10 in the video and see how to use the program.

I create a test image an convert it to 32-bit values. it sure looks like the values you're looking for.

PLEASE NOTE! the endianness is pretty important - Well, you'll figure it out if you do it the wrong way around :)

MNapi
MNapiAuthor
Senior II
August 24, 2020

Hey I saw your video a while ago when I was researching, you got the red and blue inverted. Actually I got it first inverted too when I used Bitmap Converter (ST) for emWin V5.32

I had to choose option save as red and blue inverted with alpha, then I get the code right.

You do TouchGFX it is hard to pass data from main.c to screen. How to you pass array if you want to do graph ?

I decided for now to stay with project in Keil using BSP package.

but anyway good material thanks for the video you helped a lot of people or sure.

HP_it
Senior II
August 24, 2020

the right way would be to create a queue and pass an array object through that.

the fast way is to create an extern struct or similar that you can access form the model.

You will still need to go through the model->presenter->view structure.