Jump to content
Mustafa E. Korkmaz

Windows 11 (22H2) 8bit bitmap problem

Recommended Posts

I use Delphi 11.3

 

8 bit images are displayed very badly on windows 11 computer. I think the color palette is different.

 

image1 and image2 show same 24 bit bmp on screen.
When you click to '8bit' button it changes pixel format of image2.

 

procedure TForm1.b8bitClick(Sender: TObject);
begin
 image2.Picture.Bitmap.PixelFormat := pf8bit;
end;

 

I run the same program on windows 10 and windows 11 computers. The image2 in windows 11 looks very bad.

 

The first of the attached pictures is from windows 10, the second is from windows 11 (22H2).

 

When I open the same 24-bit image in the paint brush application in windows 11 and save it as 256 colors, it still looks very bad on the screen.

 

So I guess it's not about delphi directly. But maybe it's possible to restore the old color palette from delphi.

 

The application I developed uses 8bit images heavily.

How can I solve this problem?

 

win10.png

win11.png

Edited by Mustafa E. Korkmaz

Share this post


Link to post

@Mustafa E. Korkmaz

Does this setting have any effect?
https://support.microsoft.com/en-us/windows/auto-color-management-in-windows-11-64a4de7f-9c93-43ec-bdf1-3b12ffa0870b

 

Edit:

What is the color resolution of the system that Windows 11 runs on?

Is there a way to optimize the image palette to match the default 256 color Windows palette?

Edited by Lars Fosdal
Added two questions

Share this post


Link to post

No. did not change the result

 

>Is there a way to optimize the image palette to match the default 256 color Windows palette?

 

I have no idea yet how to do it.

 

 

Share this post


Link to post
On 7/27/2023 at 6:50 PM, Lars Fosdal said:

the default 256 color Windows palette

There is no default 256 color palette. Old version of Windows "reserved" 16 fixed colors while new versions reserve 20 fixed colors.

https://en.wikipedia.org/wiki/List_of_software_palettes#Microsoft_Windows_default_20-color_palette

 

Changing the pixelformat to pf8bit forces the bitmap to use a color palette. I.e. instead of each pixel explicitly specifying the RGB color values, the pixels will contain an index into a palette of 256 colors.

The colors in a palette generated by Windows will partially depend on the system palette which again depends on the Windows theme.

https://learn.microsoft.com/en-us/windows/win32/gdi/system-palette-and-static-colors

https://learn.microsoft.com/en-us/windows/win32/gdi/default-palette

 

If you want a predictable result then you need to generate the palette using a predictable method: Either use a static palette or generate one using color quantization. There are methods in the GifImg unit for both solutions.

https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Imaging.GIFImg.ReduceColors

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×