开发者

How can I get png image RGBcolors in delphi 2009

开发者_StackOverflowI have a cipher encoded as a color series in a png image

the image is RGB-colored but the code is ciphered only in the green byte

How can I get the RGB colors in this 1x84 pixel image?


This is not difficult. Example, showing the R, G, and B bytes of pixel (0, 0):

procedure TForm1.Click(Sender: TObject);
var
  png: TPngImage;
  clr: TColor;
begin
  png := TPngImage.Create;
  try
    png.LoadFromFile('C:\example.png');
    clr := png.Canvas.Pixels[0, 0];
    ShowMessage(IntToStr(GetRValue(clr)));
    ShowMessage(IntToStr(GetGValue(clr)));
    ShowMessage(IntToStr(GetBValue(clr)));
  finally
    png.Free;
  end;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜