1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| begin
lRawImage.Init; // une dizaine de ligne du tuto FreePascal
lRawImage.Description.Init_BPP32_A8R8G8B8_BIO_TTB(0,0);
lRawImage.CreateData(false);
lii := TLazIntfImage.Create(0,0);
try
lii.SetRawImage(lRawImage);
lii.DataDescription:=GetDescriptionFromDevice(0);
// Load an image from disk.
// It uses the file extension to select the right registered image reader.
// The lii will be resized to the width, height of the loaded image.
lii.LoadFromFile(opd.FileName);
// /!\ /!\ /!\ le problème du PixelFormat 24<>32 /!\ /!\ /!\
//ShowMessage(StringReplace(lii.DataDescription.AsString, ' ', LineEnding, [rfReplaceAll]));
// /!\ /!\ /!\ depth à 24, BitsPerPixel à 32 /!\ /!\ /!\
src := TBitmap.Create;
src.PixelFormat:=pf32bit;
src.LoadFromIntfImage(lii);
//ShowMessage(StringReplace(src.RawImage.Description.AsString, ' ', LineEnding, [rfReplaceAll]));
// depth à 24, BitsPerPixel à 32
//ShowMessage(IntToStr(BytesPerPixel(src.PixelFormat)));// 3, donc pf24bit :-(
{dans le code, à propos de RawImage.Description.Depth :
Number of used bits per pixel
The color and pixel storage can be subject to alignment,
so that the logical color Depth can be less than the physical BitsPerPixel.
et Ctrl-Clic sur PixelFormat envoie vers FImage.Description.Depth : voilà l'explication du 'blème
} |
Partager