However, as pointed out by other commenters, sinc by itself isn't the greatest support function for enlargement due to the ringing artifacts [0]. Which are pretty visible in your example image [1].
ImageMagick has way more documentation on the choice of resize filter than you'll ever need [2]. But it's interesting reading nonetheless; they settled on different default filters for shrinking (Lanczos) and enlargement (Mitchell).
If anyone is curious, the algorithm is: 1) take the FFT of the image; 2) add zeros after the highest frequencies (remember to shift the data so the zero frequency is centred); and 3) inverse the shift and take the inverse FFT. This is called "zero-padding in the frequency domain."
You want to be using a DCT rather than a DFT most of the time with content like this, in order to avoid those boundary artifacts. Compare with the example on the page http://i.imgur.com/wOVMwxx.png
Source: I once maintained a small C library to do this, but eventually gave it up when it became clear how similar it was to the many existing sinc resampling implementations out there. That said, never stop experimenting.
Very neat. You may want to do something more to the edges (mirror, for instance?) to avoid high-frequency ringing artifacts there. Remember that the Fourier transform describes a repeating signal, so the borders (out into space) appear as impulses with lots of high frequency components. If you mirror, it should clean up the noise that's particularly prominent on the top and right.
As far as I can tell from the code, this is exactly the same. The approach, bandlimited interpolation, is executed in the frequency domain here and in the space domain in sinc interpolation.
Bandlimited interpolation is "correct" in some technical sense for sampled signals and images, making some assumptions about the sampling procedure. That doesn't imply it's perceptually optimal, though. If your goal is "best approximation of what I sampled given the available data", then bandlimited interpolation is good. If your goal is "image that looks good", it probably isn't.
I'm not crapping on this contribution, though, it's always cool to see more signals stuff open sourced.
To be more clear: a sinc reconstruction is correct in the sense that if the original signal was bandlimited before being sampled, the sinc reconstruction will perfectly reproduce the bandlimited input signal. All other reconstructions can produce aliasing (how much and whether it is objectionable obviously depends on the input signal).
In cases where the original signal was not bandlimited concepts like "perceptually optimal" come into play and a different reconstruction filter may be preferable.
Sinc interpolation is usually also windowed with a dampening factor on the tails of your filter. I think the ringing on the left edge of the image shows the lack of windowing.
I love that you can see the edge effects from iFFT(FFT(X)), its always interesting when you can see visual evidence of some underlying math. Anyways, I wonder if you could use a wavelet transform to reduce this.
It's actually called "ringing" and can easily be explained by the fact that you convolved with a box-function in the frequency space (ideal low pass), which will transform into a sinc function in the local space.
You can actually see it if you look closely -- there is a kind of striping of light/dark horizontal lines, easy to spot at the top & bottom of the image.
you can also try to apply a smoothening function: Usually multiplying by a gaussian in phase space will do, but this will cause your image to be blurred. What would be really impressive is if you could interpolate a pattern in the high frequency signal, and use it to "infer" values for your high frequency padding that "naturally cancel out" ringing to below the resolution of the imag.e
ImageMagick has way more documentation on the choice of resize filter than you'll ever need [2]. But it's interesting reading nonetheless; they settled on different default filters for shrinking (Lanczos) and enlargement (Mitchell).
[0] http://www.imagemagick.org/Usage/filter/#ringing
[1] http://i.imgur.com/JDPvHjf.png
[2] http://www.imagemagick.org/Usage/filter/