jexd99
asked on
Getting rgb values
Anyone know how can I tell the RGB values of a pixel? For example,
I want to run a test and show that pixel[5,7] of Timage is red 200, green 155, blue 240, and use showmessage to show these 3 values on the screen.
----------
Using scanline below, I thought this would get the values with the Buffer defined as Pbytearray, and although this seems to return values, when I copy the image to the canvas as below shows (verifying that it copies the exact image to the canvas to prove that the scanline is getting the right colors), it doesn't look exactly like the Timage, as I was expecting. I've never used scanline before so I may be missing something but I thought this was how it worked. Is there a better way to find out the individual rgb values? I'm using D3.
------------------
for j:=0 to Image1.Picture.Height - 1 do
begin
Buffer:=Image1.Picture.Bit
for i:= 0 to Image1.Picture.Width - 1 do
begin
Canvas.Pixels[i,j] := rgb(Buffer[i+0],Buffer[i+1
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Its that old 'multiply by 3' again!
Canvas.Pixels[i,j] := rgb(Buffer[i+0],Buffer[i+1
To this:
Canvas.Pixels[i,j] := rgb(Buffer[i+2],Buffer[i+1
Cheers,
Raymond.