I Want to make a program, that can write my TImage pixels rgb color to a memo, the program don't know the resolution.
so how can i recover every pixel color to String variable (R,G,B)?
code
var
Image_width,Image_height,x,y,i,i2:integer;
Colors:TColor;
begin
Image_width:=Image1.Width;
Image_height:=Image1.Height;
memo1.text:='$image_width=*'+IntToStr(Image_Width)+
'$$image_height='+IntToStr(Image_Height)+'*$';
x:=1;
y:=1;
for i := 1 to Image_width do begin
for i2 := 1 to Image_height do begin
Colors:=Image1.Canvas.Pixels[x,y];
memo1.Text:=memo1.Text+ColorToString(Colors);
y:=y+1;
end;
x:=x+1
end;
end
|Edited|
procedure TForm1.Button2Click(Sender: TObject);
var
Image_width,Image_height,x,y:integer;
Colors:TColor;
s:string;
begin
Image_width:=Image1.Width;
Image_height:=Image1.Height;
memo1.text:='$image_width=*'+IntToStr(Image_Width)
+'*$ $image_height=*'+IntToStr(Image_Height)+'*$';
x:=0;
y:=0;
memo1.Lines.BeginUpdate;
for x := 0 to Image_width do begin
for y := 0 to Image_height do begin
Colors:=Image1.Canvas.Pixels[x,y];
memo1.Text:=Memo1.Text+ColorToString(Colors);
end;
memo1.Lines.EndUpdate;
end;
end;
It completes very slow, i think 19 second with a 640x480 picture. And after the program ready, and it put to memo1, i see something in memo1 but the program "not responding" again..
I tried with the s variable, and the program do the same.