Note: The input URL will not work under Firefox. Firefox considers it a security violation for me to read pixels from an image that is on another site. I can blit the image into my own canvas, but then I cannot read my own canvas after that. Feh.
Here is the git repository for this code.
Fast Fourier Transform
Note: the data shown is not the actual complex data. It is just the magnitude of the complex numbers. The real floating point data is stored behind the scenes. When you paint, you are painting on the real floating point data.
Most folks only bother scaling the complex data during the inverse FFT. I have opted to scale on both the FFT and the inverse FFT. As such, if you do the FFT twice in a row, you almost get back the original. The difference comes from the fact that I shift the image with each FFT so that the low-order frequencies are at the center of the image. This is the way most people are accustomed to seeing them. If I did not do this, the FFT image would look like the IFFT of an original image looks here.
PaintColor (Hue/Sat and Value):
GradientInner Color (Hue/Sat and Value):