interpolation!
http://www.cambridgeincolour.com/tutorials/image-interpolation.htm
uhhh, odd though, I can't find any really good pictures of bilinear interpolation for image resizing....
Linear interpolation works like this: First, you have an interpolation value, T. When T=0, your function returns a value A. When T=1, your function returns the value B. For linear interpolation, the equation, F(T)=(b-a)*T+a. As T varies from 0 to 1, F(T) varies from A to B.
in 2d, with colors, that looks like this:
http://www.cs.lmu.edu/~ray/images/ogl-triangle.png
The colors are only given at each vertex of the triangle, but you can interpolate between each vertex. Imagine the vertices are pixels, and the gradient is a "continuum", that will eventually be rasterized (= a finite 2d array of pixels). So if you have a grid of pixels, you can come up with a continuum of colors (what I mean by continuum is that there is no smallest unit). Then, you resize the thing, and take differnet points on that continuum, and turn 'em into pixels!