Hello,
Many years ago, I've written a little program to look inside the bitmaps header, where the data are ok, for example, the first image shows what is retrieved with ghex, and we can read at position 1C the value 18 for one file, meaning 24 bits, and 20 for the other file, meaning 32 bits.
analyse_3x2_2432_v1.pngOn that file, look at the bytes FF in the second screenshot, it's the alpha channel, not available in the top screenshot where we see underlined (by me) "00" for padding.
That image (zoomed at 800% in the top windows) has only six colored pixels, so easy to analyze.
The 6 blocks of data in the bottom window come from a ColorPicker, and we retrieve the values seen in the hexa tables but read from right to left.
I've tried my tool with many many many files and everything is OK : if no alpha channel, 1C = 18, if alpha channel, 1C = 20.
When we look at the beginning of the data, we read FF 00 00 FF 00 00 etc. so 3 bytes per pixel, coming from the 24 bits file, and we read FF 00 00 00 FF 00 00 00 etc. so 4 bytes per pixel coming from the 32 bits file.
And I don't understand why the DataDescription is not able to retrieve the good values :
lii.DataDescription.Depth // is always at 24
lii.DataDescription.BitsPerPixel // is always at 32
How is it possible ?
On the other side, I've found a web page updated in feb.24 and anyway, outdated...
wrong_lazarus_intfgraphics.imgThat's really a pity !
A last word :
Found in
IntfGraphics.pas :
procedure TLazWriterBMP.Initialize(AImage: TLazIntfImage);
begin
// set BPP
// we can also look at PixelFormat, but it can be inexact <-- ha ha ha ! lol !
BitsPerPixel := AImage.DataDescription.Depth;
end;
BitsPerPixel := AImage.DataDescription.Depth; ok, so why do I read 32 24 ?
retrieve_descr.pngWhat is this mess (to be polite) ?