Point(Pictureなど)
Pointメソッドは指定された座標の色を返します。Delphiでは TCanvas型のプロパティを持っているコンポーネントなら TCanvasの「Pixels」プロパティを使用して調べます。戻り値は TColor型です。TColor型を RGBの値として扱いたい場合は ColorToRGB関数で変換可能です。
■ TImageにロードした画像のピクセル情報を取得する例 procedure TForm1.Button1Click(Sender: TObject); var x,y : integer; colPix : TColor; begin {画像を開くダイアログ} if (OpenPictureDialog1.Execute) then begin {画像を読み込む} Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName); {画像にコントロールのサイズを合わせる} Image1.AutoSize := True; {リストボックスのクリア} ListBox1.Items.Clear; ListBox1.Items.BeginUpdate; for y := 0 to Image1.Height do begin for x := 0 to Image1.Width do begin {色取得} colPix := Image1.Canvas.Pixels[x,y]; {ピクセル情報をリストボックスに追加} ListBox1.Items.Add( ' X=' + IntToStr(x) + ':Y=' + IntToStr(y) + {色の内容を文字列へ} ':Color=' + ColorToString(colPix)); end; end; ListBox1.Items.EndUpdate; end; end;