Type
TBArray = Array of Byte;
Var aBArray : TBArray;
procedure Bitmap2ByteArray(const aBMP: TBitmap;var ByteArray: TBArray);
var MS: TMemoryStream;
begin
MS := TMemoryStream.Create;
try
aBMP.SaveToStream(MS);
MS.Seek(0, soFromBeginning);
SetLength(ByteArray, MS.size);
MS.ReadBuffer(ByteArray[0], Length(ByteArray));
finally
MS.free;
end;
end;
// Utilisation
procedure TForm1.Button1Click(Sender: TObject);
begin
Bitmap2ByteArray(Image1.Picture.Bitmap, aBArray);
end;