var img: TBGRABitmap;
mybitmap:TBitmap;
x,y:integer;
tempcolor,thirdcolor:TColor;
readfile:TextFile;
begin
mybitmap := TBitmap.create;
mybitmap.width := image1.width;
mybitmap.height := image1.height;
mybitmap.assign(image1.picture.bitmap); //TImage
img := TBGRABitmap.create(mybitmap.width,mybitmap.height);
img.assign(mybitmap);
assignfile(readfile,'edges.txt');
reset(readfile);
while not eof(readfile) do //or for i := to 1 to numberofentries do
begin
//the program reads each entry in the text file to get 2 colors along with x and y
//code which uses those 2 colors to produce a third color
img.SetPixel(x,y,thirdcolor);
end;
img.free;
mybitmap.free;
closefile(readfile);
end;