Kod wyciety z programu, po niewielkich modyfikacjach powinien dzialac ;)
{-----------------------------------------------------------------------}
{ Skalowanie metodą interpolacji dwuliniowej
{-----------------------------------------------------------------------}
procedure TForm1.ScalBilinearInterpolation(var sorc : TImage; var des : TImage);
var i, j, c : Integer;
cx, cy, z, s : Integer;
p, q, rx, ry : Single;
ln : PByteArray;
begin
{ wyliczenie współczynników }
p := des.Width/sorc.Width;
q := des.Height/sorc.Height;
{ skalowanie }
for j:=0 to des.Height-1 do begin
Division(j/q, cy, ry);
ln := des.Picture.Bitmap.ScanLine[j];
c := 0;
for i:=0 to des.Width-1 do begin
Division(i/p, cx, rx);
z := cx*3;
if cx<sorc.Width-1 then s := z + 3 else s := z;
ln[c+2] := BiLinearInterpolate(li[cy][z+2], li[cy][s+2], li[cy+1][z+2], li[cy+1][s+2], rx, ry); //red
ln[c+1] := BiLinearInterpolate(li[cy][z+1], li[cy][s+1], li[cy+1][z+1], li[cy+1][s+1], rx, ry); //green
ln[c] := BiLinearInterpolate(li[cy][z] , li[cy][s] , li[cy+1][z] , li[cy+1][s] , rx, ry); //blue
c := c + 3;
end;
end;
end;
function TForm1.BiLinearInterpolate(c1, c2, c3, c4 : Byte; dx, dy : Single):Byte;
var a, b, c : Single;
begin
{ interpolacja wzdluz osi x }
a := c1 + (c2-c1)*dx;
b := c3 + (c4-c3)*dx;
{ interpolacja wzdluz osi y }
c := a + (b-a)*dy;
Result := Round(c);
end;
{ rozbija liczbe rzeczywista num na calkowita full i czesc ułamkowa fraction }
procedure TForm1.Division(num : Single; var full : Integer; var fraction : Single);
begin
full := Trunc(num);
fraction := num - full;
end;