Thursday, April 26th 2018, 10:54pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Dejan

Beginner

Date of registration: Mar 16th 2018

Posts: 2

1

Saturday, March 17th 2018, 2:48pm

BmpCVT color conversion

I am confused with "Options->Save colors in ARGB mode" flag. I am using a display with 64K colors in ARGB mode. I want to convert Windows BMP files to HighColor (565). Whatever I do,
I can't create the right color order -> blue and red are always swapped. I created both HighColor(565) and HighColor(565) swapped files. Colors inside the file are correctly swapped, but
color encoding method in the bitmap description complement that so images are always shown in the same (wrong) way. Also, changing that Options flag and re-creating the files never
results in any file difference. Interestingly, if I paletize the images first, colors are shown correctly.
I am using the latest version of BmpCvt (5.46a) and GUI (5.46) and I would appreciate some guidance here.
Also, when I try to open 64K color BMP file, BmpCVT locks so I have to kill it using TaskManager (example ZIP file with BMP image attached).
Dejan has attached the following file:
  • Button2.zip (4.6 kB - 32 times downloaded - Last download: Today, 6:37pm)

This post has been edited 1 times, last edit by "Dejan" (Mar 17th 2018, 2:52pm)


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 562

2

Tuesday, March 20th 2018, 3:35pm

Hi,

I was able to reproduce the behavior with your BMP file. This needs further investigation.

If I get you right you want to convert an image (a BMP file in this case) into a 16 bit per pixel bitmap to be drawn with emWin.

You don't have to use a 16 bit BMP to do so. Simply create a BMP file (e.g. with paint or GIMP) and save it with 24 bpp.

Now open the BMP file with the Bitmap Converter and go to: File -> Save As -> choose: "C" bitmap file (*.c)

Now you can decide between several color formats. Depending on your LCD configuration (the color conversion you are using, e.g. GUICC_M565 or GUICC_565) you should use one of the following:

High Color (565) - This is 16 bit in BGR order to be used with GUICC_565
High Color (565), red and blue swapped - This is 16 bit in RGB order to be used with GUICC_M565

If you want to convert a 32 bpp image into an emWin bitmap it might be necessary to convert it to 24 bpp. You can do this in the bitmap converter under:

Image -> Convert to -> RGB (24 bpp)

The option 'Save colors in ARGB mode' option effects only pallete based bitmaps. This is not the case here.

Another possibility might be that the LCD configuration is not properly set up. You might want to try to set a different color conversion in your LCDConf.c. for example, instead of using GUICC_M565 use GUICC_565.

Regards
Sven

Dejan

Beginner

Date of registration: Mar 16th 2018

Posts: 2

3

Wednesday, March 21st 2018, 3:37pm

BMPCVT issues

Thanks for you response. I am familiar with color modes - what confuses me is this: - it does not matter what kind of file (565 or swapped 565 format) I choose - the resulting image is always shown the same way. I would expect that if I choose the wrong format (e.g. 565 instead of swapped 565), color should be swapped too. However, that's not the case. Files are differently organized, but encoding method is also changed -> therefore EmWin always displays the same image. If I manually change encoding method in c-file, it is then show the right way.
I have configured lcdconf.c the right way, tested it with blue/red bars and they are shown correctly, the problem is only with these 565-formated BMP's.

This post has been edited 1 times, last edit by "Dejan" (Mar 21st 2018, 3:38pm)


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 562

4

Thursday, March 22nd 2018, 9:30am

Hi,

Quoted

the resulting image is always shown the same way.
Indeed, this is strange. I would also expect the colors to be swapped.

Which hardware are you using?
Which emWin driver are you using?
Can you post your configuration file (LCDConf.c and GUIConf.h)?

Regards
Sven