Convert NSImage to Bitmap lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- aradeonas · 2016-04-21 16:09 Hi, I want to get a file icon like here and in Lazarus result is NSImage, How could I convert it to TBitmap so I can load it to a Image or save to a file? ---------------------------------------------------------------------- aradeonas · 2016-05-04 18:43 Any info? ---------------------------------------------------------------------- skalogryz · 2016-05-04 18:52 are you trying to get an icon from a bundle? or from a particular NSImage? ---------------------------------------------------------------------- aradeonas · 2016-05-04 19:01 Thanks for replay. As I linked I want to use iconForFile to get thumbnail for file (app or image or pdf) as OS shows and its result is NSImage ---------------------------------------------------------------------- LazProgger · 2016-05-10 00:59 Perhaps this can help you: 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  function TPixMapManager.GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;var  I: Integer;  nImage: NSImage;  nData: NSData;  nRepresentations: NSArray;  nImageRep: NSImageRep;  WorkStream: TBlobStream;  tfBitmap: TTiffImage;  bmBitmap: TBitmap;begin  Result:= -1;  if not FUseSystemTheme then Exit;  nImage:= NSWorkspace.sharedWorkspace.iconForFileType(NSSTR(PChar(AFileExt)));  nRepresentations:= nImage.Representations;  if AIconSize = 22 then AIconSize:= 32;  for I:= nRepresentations.Count - 1 downto 0 do  begin    nImageRep:= NSImageRep(nRepresentations.objectAtIndex(I));  if (AIconSize <> nImageRep.Size.Width) then      nImage.removeRepresentation(nImageRep);  end;  if nImage.Representations.Count = 0 then Exit;  nData:= nImage.TIFFRepresentation;  tfBitmap:= TTiffImage.Create;  WorkStream:= TBlobStream.Create(nData.Bytes, nData.Length);  try    tfBitmap.LoadFromStream(WorkStream);    bmBitmap:= TBitmap.Create;    try      bmBitmap.Assign(tfBitmap);      Result:= FPixmapList.Add(bmBitmap);    except      bmBitmap.Free;    end;  finally    tfBitmap.Free;    WorkStream.Free;  end;end;   Source: https://sourceforge.net/p/doublecmd/code/HEAD/tree/trunk/src/p latform/upixmapmanager.pas