Bien joué !

Là où tu vas pleurer toutes les larmes de ton corps, c'est quand tu vas vouloir adapter des codes pêchés ici et là sur le web : pour peu qu'ils soient écrits d'une manière "propriétaire", ça va te faire drôle !
Exemple : j'ai trouvé une fonction de redimensionnement qui commence comme ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
  begin
    if SourceBitmap.PixelFormat <> pf32bit then raise Exception.Create(ERRMSG1);
avec
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
  const
    ERRMSG1 = 'Only pf32bit PixelFormat supported';
et à force de batailler comme un diable, cette première ligne a purement et simplement finie commentée, à cause de ça dans l'appel (lii c'est une TLazIntfImage) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
}
J'aurais pu ruser et utiliser le TBitmapInfoHeader, mais comme la fonction commençait avec PixelFormat qui remonte à pf24bit quoi que je fasse, ben test mis en commentaire et voilà.
(je n'arrive pas à trouver comment Lazarus récupère les BitsPerPixels...)