Does GetPixel work with TBGRABitmap? lazarus / 39-Graphics ---------------------------------------------------------------------- user5 · 2019-12-17 09:59 I can't get GetPixel(x,y) to work with TBGRABitmap. The code below keeps coming up with clNone. Can someone show me what I'm doing wrong or show me a simple example of how to use GetPixel with TBGRABitmap? Thanks.     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.Button12Click(Sender: TObject);var mybitmap:TBitmap;    bgra:TBGRABitmap;    tempcolor:TColor;    tempstr:string;begin  mybitmap := TBitmap.create; mybitmap.width := image1.width; mybitmap.height := image1.height; mybitmap.assign(image1 .picture.bitmap); application.processmessages;  bgra := TBGRABitmap.cr eate(mybitmap.width,mybitmap.height); bgra.assign(mybitmap);  tempcolo r := bgra.GetPixel(30,30); tempstr := ColorToString(tempcolor); edit1.text := tempstr;  bgra.free; mybitmap.free; end; ---------------------------------------------------------------------- user5 · 2019-12-17 12:00 I did some research and testing and found something that works. If anyone is interested the code below works with GetPixel and BGRABitmap. Thanks anyway.     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.Button12Click(Sender: TObject);var mybitmap:TBitmap;    bgra:TBGRABitmap;    tempcolor:TColor;    tempstr:string;    c: TBGRAPixel;begin  mybitmap := TBitmap.create; mybitmap.width := image1.width; mybitmap.height := image1.height; mybitmap.assign(image1 .picture.bitmap); application.processmessages;  bgra := TBGRABitmap.cr eate(mybitmap.width,mybitmap.height); bgra.assign(mybitmap);  c := bgra.GetPixel(30,30); tempcolor := BGRAToColor(c);  tempstr := ColorToString(tempcolor); edit1.text := tempstr;  bgra.free; mybitmap.free; end; ---------------------------------------------------------------------- circular · 2019-12-19 15:53 You can try something like bgra.GetPixel(30,30).ToColor ---------------------------------------------------------------------- winni · 2019-12-19 16:29 @user5 You can simplify your code. Your lines 15 & 16 could be pulled to one line. From 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 bgra := TBG RABitmap.create(mybitmap.width,mybitmap.height);bgra.assign(mybitmap); To 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 bgra := TBGRABitmap.create(mybitmap);  It creates a TBGRABitmap with height and width of myBitmap and then it make a copy. Winni