Performing DFT twice on an image. Why am I getting an inverted image?
It's a DFT property that if you apply DFT twice to input data, you get the original signal flipped (circularly). Stated mathematically for 1D case:

$$ x[n] \xrightarrow{ N-DFT } X[k] $$
$$ X[k] \xrightarrow{ N-DFT } Y[k] = N x[-k] $$

similar result can be shown for 2D case. And as you can see, the resulting output is the flipped (horizontally and vertically) original data.

You can see mathematical derivation in other questions on this site. I remember having answered that before. Please check this site for applying DFT or FFT twice. 

Such as this answer...