Best way to resample a signal (image)? I have an original image $\ I(x_i,y_j)$ where 

$\ x_i = i*\Delta x, 0&lt;= i &lt; n_i $ 

and 

$\ y_j = j*\Delta y, 0&lt;= j &lt; n_j$

I am trying to implement a function that resamples the image to:

$\ I(x_k,y_l)$ where 

$\ x_k = k*\Delta xx, 0&lt;= k &lt; n_k $ 

and 

$\ y_l = l*\Delta yy, 0&lt;= l &lt; n_l$

The case when $\ \Delta xx &lt;= \Delta x $ and $\ \Delta yy &lt;= \Delta y $ : upsampling,
is quite easy (?). 

Linear interpolation between nearest neighbours should do a decent job?   

Downsampling on the other hand is more tricky.

To make sure Nyquist is followed so that no aliasing occurs; I must lowpass filter before decimating.

How do I do this an good yet simple manner?

I was thinking maybe using the FFT to do both upsampling and downsampling:


take the FFT of the image
zero pad or truncate the FFT
inverse FFT


In the case of zero padding this amount to sinc interpolation (which is better than linear interpolation)? 

In the case of truncation this amount to (ideal) lowpass filtering?

So this should be a both simple to implement and very good solution?

I guess one thing to look out for is edge effects.

How do I best avoid this?

I was thinking repeating the image twice in x and y and then circulary shifting it half the width and height of the image.
That should make the padded image cyclical periodic.
An FFT approach to filtering/resampling should work fine, but you don't want to just truncate or pad with zeros.  That will add effects to the image.  See here for more information about FFT resampling.

You could also just do a FIR filter.  If you upsample by a ratio of $\frac{p}{q}$ then you would want your anti-aliasing filter to have a normalized bandwidth of $\frac{q}{p}$.  You could make the bandwidth a little smaller to get rid of more alias energy, as desired.  If you downsample by a ratio of $\frac{p}{q}$ then you would want the filter bandwidth to also be about $\frac{p}{q}$.  Again, you could make it a little smaller to get rid of more alias energy.

Once you have your filter you just need to do a two-dimensional convolution and trim the extra resulting samples on each edge.  Many signal processing libraries have built-in two-dimensional filtering routines that can do this for you.