Where is defined TPNGImage? lazarus / 39-Graphics ---------------------------------------------------------------------- Edson · 2017-02-08 20:38 I've seen several examples using TPNGImage, but I don't know, in which unit it's defined in Lazarus.  Does it need to install some extra package? I need to load some PNG files into a TImageList. ---------------------------------------------------------------------- wp · 2017-02-08 20:49 Just load them. PNG support is built into the ImageList. For processing of the PNG image there's the TPortableNetworGraphic in graphics. ---------------------------------------------------------------------- Edson · 2017-02-08 21:25 Some code please. ---------------------------------------------------------------------- Edson · 2017-02-08 21:29 I'm using: 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 var  bmp: TBitmap;  pngbmp: TPortableNetworkGraphic;begin   pngbmp:=TPortableNetworkGraphic.Create;   pngbmp.LoadFromFile(imgArc);   bmp:=TBitmap.Create;   pngbmp.Assign(bmp);   Result:= imagList16.Add(bmp, nil);   bmp.Destroy;   pngbmp.Destroy;end; But this seems not to work. ---------------------------------------------------------------------- wp · 2017-02-08 21:40 You did not say that you want to add images by code. This works for me (based on the first few lines of the OnClick code of the Add button in the ImageListEditor): 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);const  fn = 'C:\lazarus- trunk_fpc300\images\actions\arrow_down.png';var  srcBmp: TBitmap;  Picture: TPicture;begin  Picture := TPicture.Create;  try    Picture.LoadFromFile(fn);    SrcBmp := TBitmap.Create;    SrcBmp.Assign(Picture.Graphic);    ImageList1.Add(SrcBmp, nil);    ListView1.Invalidate;                // hooked to the image list  finally    Picture.Free;  end;end; ---------------------------------------------------------------------- Edson · 2017-02-08 21:48 Quote from: wp on February 08, 2017, 10:40:14 pmYou did not say that you want to add images by code. Sorry. It was my fault. I was trying to use TPNGImage to do by code. Thanks, by the code. This works too: 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 var  pngbmp: TPortableNetworkGraphic;begin   pngbmp:=TPortableNetworkGraphic.Create;   pngbmp.LoadFromFile('myfile.png');   Result:= imagList16.Add(pngbmp, nil);   pngbmp.Destroy;end;