@Emile: sometimes you are rather strange. Don’t whine - make it better. Here is a bilinear interpolation (translated from Java). Bicubic didn’t make much of a difference and the algorithm is much more compliated:

[quote]Private Function BilinearInterpolation(OriginalPicture as Picture, newWidth as Integer, newHeight as Integer, constrainProportion as Boolean) As Picture

dim w as Integer = OriginalPicture.Width

dim h as Integer = OriginalPicture.Height

dim x_ratio as Double = (w - 1)/newWidth

dim y_ratio as Double = (h - 1)/newHeight

if constrainProportion then

if x_ratio >= y_ratio then

newHeight = h/x_ratio

else

newWidth = w/y_ratio

end if

x_ratio = max(x_ratio, y_ratio)

y_ratio = max(x_ratio, y_ratio)

end if

dim oldSurf as RGBSurface = OriginalPicture.RGBSurface

dim oldMaskSurf as RGBSurface = OriginalPicture.Mask.RGBSurface

dim InterpolatedPicture as new Picture(newWidth, newHeight, 32)

dim InterpolatedSurf as RGBSurface = InterpolatedPicture.RGBSurface

dim InterpolatedMaskSurf as RGBSurface = InterpolatedPicture.mask.RGBSurface

dim x, y, alphaValue as Integer

dim x_diff, y_diff, blue, red, green, gray as Double

dim a, b, c, d as Color

for i as Integer = 0 to (newHeight - 1)

for j as Integer = 0 to (newWidth - 1)

x = x_ratio * j

y = y_ratio * i

x_diff = (x_ratio * j) -x

y_diff = (y_ratio * i) - y

```
'calculations for red, green and blue
a = oldSurf.Pixel(x, y)
b = oldSurf.Pixel(x + 1, y)
c = oldSurf.Pixel(x, y + 1)
d = oldSurf.Pixel(x + 1, y + 1)
blue = (a.Blue * (1 - x_diff) * (1 - y_diff)) + (b.Blue * x_diff * (1 - y_diff)) + (c.Blue * y_diff * (1 - x_diff)) + (d.Blue * x_diff * y_diff)
green = (a.green * (1 - x_diff) * (1 - y_diff)) + (b.green * x_diff * (1 - y_diff)) + (c.green * y_diff * (1 - x_diff)) + (d.green * x_diff * y_diff)
red = (a.red * (1 - x_diff) * (1 - y_diff)) + (b.red * x_diff * (1 - y_diff)) + (c.red * y_diff * (1 - x_diff)) + (d.red * x_diff * y_diff)
InterpolatedSurf.Pixel(j, i) = RGB(red, green, blue)
'now the mask
a = oldMaskSurf.Pixel(x, y)
b = oldMaskSurf.Pixel(x + 1, y)
c = oldMaskSurf.Pixel(x, y + 1)
d = oldMaskSurf.Pixel(x + 1, y + 1)
gray = (a.Blue * (1 - x_diff) * (1 - y_diff)) + (b.Blue * x_diff * (1 - y_diff)) + (c.Blue * y_diff * (1 - x_diff)) + (d.Blue * x_diff * y_diff)
InterpolatedMaskSurf.Pixel(j, i) = RGB(gray, gray, gray)
next
```

next

Return InterpolatedPicture

End Function

[/quote]