开发者_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;
精彩评论