Example from the beginning of IntfGraphics.pas works or not, regarding the targe lazarus / 39-Graphics ---------------------------------------------------------------------- jipété · 2024-06-19 10:43 Hello, if I start with a .xpm file (I have one), it works. (caution with CreateBitmap, unknown ! "s" needed : CreateBitmaps) But if I want to change the texts ...XPM by ...BMP I get black images, pf24bit as pf32bit, PixelFormat present or not, adding SetSize or not. Dunno what to do, dunno where to look... The code : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  BmpHnd,MaskHnd: HBitmap;  Bitmap1: TBitmap;  IntfImg1: TLazIntfImage;  ReaderXPM: TLazReaderXPM;  WriterXPM: TLazWriterXPM;  ReaderBMP: TLazReaderBMP;  WriterBMP: TLazWriterBMP;{begin // that part works fine  Bitmap1:=TBitmap.Create;  // create a bitmap (or use an existing one)  IntfImg1:=TLazIntfImage.Create(0,0,[riqfRGB, riqfAlpha, riqfMask]);  // create the raw image for the screenformat you want  ReaderXPM:=TLazReaderXPM.Create;  // create the XPM reader  IntfImg1.LoadFromFile('filenamein.xpm',ReaderXPM);  // load the image  IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);  // create the bitmap handles  Bitmap1.Handle:=BmpHnd;  // apply handles to the Bitmap1  Bitmap1.MaskHandle:=MaskHnd;  ReaderXPM.Free;  // clean up  IntfImg1.Free;  // do something with the Bitmap1  // nothing to do...  IntfImg1:=TLazIntfImage.Create(0,0,[]);   // create the raw image  IntfImg1.LoadFromBitmap(Bitmap1.Handle,Bitmap1.MaskHandle);  // load the raw image from the bitmap handles  WriterXPM:=TLazWriterXPM.Create;  // create the XPM writer  IntfImg1.SaveToFile('filenameout.xpm',WriterXPM);  // save image to file  WriterXPM.Free;  // clean up  IntfImg1.Free; }//begin   // BMP black image size ok  Bitmap1:=TBitmap.Create;  // create a bitmap (or use an existing one)  Bitmap1.PixelFormat:=pf24bit; // added by me  Bitmap1.SetSize(TargetImg.Width, TargetImg.Height);//ok  showMessage(inttostr(TargetImg.Width)+' '+inttostr(TargetImg.Height));  IntfImg1:=TLazIntfImage.Create(0,0,[riqfRGB, riqfAlpha, riqfMask]);  // create the raw image for the screenformat you want  ReaderBMP:=TLazReaderBMP.Create;  // create the BMP reader  IntfImg1.LoadFromFile('filenamein24.bmp',ReaderBMP);  // load the image  IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);  // create the bitmap handles  Bitmap1.Handle:=BmpHnd;  // apply handles to the Bitmap1  Bitmap1.MaskHandle:=MaskHnd;  ReaderBMP.Free;  // clean up  IntfImg1.Free;  // do something with the Bitmap1  // nothing to do...  IntfImg1:=TLazIntfImage.Create(0,0,[]);   // create the raw image  IntfImg1.LoadFromBitmap(Bitmap1.Handle,Bitmap1.MaskHandle);  // load the raw image from the bitmap handles  WriterBMP:=TLazWriterBMP.Create;  // create the XPM writer  IntfImg1.SaveToFile('filenameout24.bmp',WriterBMP);  // save image to file  WriterBMP.Free;  // clean up  IntfImg1.Free;////begin   // BMP black image size ok  Bitmap1:=TBitmap.Create;  // create a bitmap (or use an existing one)  Bitmap1.PixelFormat:=pf32bit; // added by me  Bitmap1.SetSize(TargetImg.Width, TargetImg.Height);  IntfImg1:=TLazIntfImage.Create(0,0,[riqfRGB, riqfAlpha, riqfMask]);  // create the raw image for the screenformat you want  ReaderBMP:=TLazReaderBMP.Create;  // create the BMP reader  IntfImg1.LoadFromFile('filenamein32.bmp',ReaderBMP);  // load the image  IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);  // create the bitmap handles  Bitmap1.Handle:=BmpHnd;  // apply handles to the Bitmap1  Bitmap1.MaskHandle:=MaskHnd;  ReaderBMP.Free;  // clean up  IntfImg1.Free;  // do something with the Bitmap1  // nothing to do...  IntfImg1:=TLazIntfImage.Create(0,0,[]);   // create the raw image  IntfImg1.LoadFromBitmap(Bitmap1.Handle,Bitmap1.MaskHandle);  // load the raw image from the bitmap handles  WriterBMP:=TLazWriterBMP.Create;  // create the XPM writer  IntfImg1.SaveToFile('filenameout32.bmp',WriterBMP);  // save image to file  WriterBMP.Free;  // clean up  IntfImg1.Free;end; Thanks, In the zip are two bmp files, one 24bits and the other 32 :