Einzelnen Beitrag anzeigen

Klaus01
Online

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: Pixel(Farbwerte) aus einer Bitmap datei auslesen

  Alt 8. Jan 2009, 20:31
Guten Abend,

an die einzelnen Pixel kommst Du so ran:

Delphi-Quellcode:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
  color : TColor;
  x,y : Integer;
begin
  for x:=0 to Image1.Picture.Bitmap.Width -1 do
    for y:=0 to Image1.Picture.Bitmap.Height -1 do
     color :=Image1.Picture.Bitmap.Canvas.Pixels[x,y];
end;
Aus der Hilfe:
Zitat:
If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red. $00000000 is black and $00FFFFFF is white.
Du musst den TColor Wert nur entsprechend maskieren um die einzelnen Farbwerte zu bekommen.

Delphi-Quellcode:
blue := color and $00FF0000;
green := color and $0000FF00;
red := color and $000000FF;
Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat