简体   繁体   English

如何在delphi 2009中获得png图像RGBcolors

[英]How can I get png image RGBcolors in delphi 2009

I have a cipher encoded as a color series in a png image 我有一个密码编码为png图像中的颜色系列

the image is RGB-colored but the code is ciphered only in the green byte 图像为RGB颜色,但代码仅在绿色字节中加密

How can I get the RGB colors in this 1x84 pixel image? 如何获得此1x84像素图像中的RGB颜色?

This is not difficult. 这并不困难。 Example, showing the R, G, and B bytes of pixel (0, 0): 示例,显示像素(0,0)的R,G和B字节:

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM