Getting image data lazarus / 39-Graphics ---------------------------------------------------------------------- AsleyCruz · 2025-09-02 16:47 Hi coders, Can you please give me a function to get the image data from a TSpeedButton control? Here is an idea of what I'm trying to get in string from "Glyph" property from TSpeedButton: Function result: 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   Glyph.Data = {    36100000424D3610000000000000360000002800000020000000200000000100    2000000000000010000064000000640000000000000000000000000000000000    0000000000000000000000000000000000000000000000000000000000000000    ...  } Thanks in advance! ---------------------------------------------------------------------- wp · 2025-09-02 17:44 The string consists of the hex string representation of byte values, i.e. take groups of always two digits and convert that to a byte, put all bytes into an array and write that to a stream. The stream finally can be opened by a TPicture. But note that there is a 4-byte header which must be ignored. See the sequence '424D' in the first line? This corresponds to 'BM' which is the signature of a bmp file. 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 PictureFromGlyphData(DataStr: String; APicture: TPicture);var  b: TBytes = nil;  i, j, n: Integer;  s: String[3] = '$__';  stream: TStream;begin  i := 1;  j := 0;  n := Length(DataStr);  SetLength(b, n div 2);  while i < n do  begin    s[2] := char(DataStr[i]);    s[3] := char(DataStr[i+1]);    b[j] := StrToInt(s);    inc(j);    inc(i, 2);  end;   stream := TMemoryStream.Create;  try    stream.Write(b[4], Length(b)-4);    // Skip 4-byte header    stream.Position := 0;    APicture.LoadFromStream(stream);  finally    stream.Free;  end;end; ---------------------------------------------------------------------- AsleyCruz · 2025-09-02 18:06 Quote from: wp on September 02, 2025, 07:44:18 pmThe string consists of the hex... Hi, this works perfect in reverse converting from Image data to TPicture but, let me ask you about converting TPicture to image data. Thanks for your time. I have the SpeedButton1 and want to convert the glyph data into string. i.e: 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 Glyph.Data = {  361000...}