Great question. Ive never heard of this, but the Gimp Fourier plugin seems really neat:
A simple plug-in for converting Fourier to an image. The main advantage of this plugin is the ability to work with the converted image inside GIMP. You can draw or apply filters in Fourier space this way and get a modified image using the inverse FFT.
The idea of doing Gimp-style manipulations on frequency data and converting it back to image is very cool! Despite years of working with FFT, I never thought about that. Instead of messing with Gimp plugins and C executables and ugliness, do it in Python!
Warning. I experimented with several ways to do this, trying to get something close to the Gimp Fourier output image (gray with a moire pattern) from the original input image, but I just couldn’t. The Gimp image seems somewhat symmetrical around the middle of the image, but it doesn’t inverted vertically or horizontally, as well as transposed-symmetric. Id expects the plugin will use a real 2D FFT to convert an H × W image to an H × W array of real data in the frequency domain, and in this case there will be no symmetry (its just a complex FFT thats conjugate-symmetric for real inputs, like images) . So I gave up trying to reprogram what the Gimp plugin does and saw how Id does it from scratch.
Code. Very simple: read the image, apply scipy.fftpack.rfft in the leading two dimensions to get the "frequency image", rescale to 0-255 and save.
Notice how different this is from the other answers! Without shades of gray - 2D real real FFT occurs independently on all three channels. No abs : the image of the frequency domain can have legitimate negative values, and if you make them positive, you cannot restore the original image. (Also a good feature: no compromise on image size. The array size remains the same before and after the FFT, whether the width / height is even or odd.)
from PIL import Image import numpy as np import scipy.fftpack as fp
( Beyond this: Fik-lover geek note. See the documentation for rfft for rfft , but I used the Scipys FFTPACK module because its rfft interleaves the real and imaginary components of one pixel as two adjacent real values, ensuring that the output for any 2D image size (even against odd, width versus height) will be saved.This is unlike Numpys numpy.fft.rfft2 , which, since it returns complex data of size width/2+1 to height/2+1 , forces you to deal with one extra row / column and deal with interleaving access to complex to the real one. Who needs this problem for this application.)
Results. The specified input named test.png :

this fragment outputs the following result (global min / max was rescaled and quantized to 0-255):

And it scales:

In this frequency image, the DC component (0 Hz) is in the upper left corner, and when moving forward and down, the frequencies move higher.
Now let's see what happens when you manipulate this image in several ways. Instead of this test image, you can use a photo of a cat .

I made several mask images in Gimp, then load it into Python and multiply the frequency image to see what effect the mask has on the image.
Here is the code:
# Make frequency-image of cat photo freq = im2freq(np.array(Image.open('cat.jpg')))
Here is the filter mask of the lower filter on the left, and on the right is the result to see the full resolution image:

In the mask, black = 0.0, white = 1.0. Thus, the low frequencies are saved here (white), and the high ones are locked (black). This blurs the image by attenuating high frequencies. Low-pass filters are used everywhere, including when destroying ("downsampling") images (although they will be formed much more carefully than I draw in Gimp 😜).
Has a bandwidth , where are the low frequencies (see the white bit in the upper left corner?) and high frequencies are preserved, but the middle frequencies are blocked. Very strange!

Here is a high pass filter , where the upper left corner remaining white in the specified mask is darkened:

This is how edge detection works.
Postscript Someone, make a webapp using this method, which allows you to draw masks and apply them to the image in real time !!!