validation of a pseudo jpeg compression I've done something which is not exactly the jpeg algorithm. What I've done is that given an image $I$ of $N\times N$ size, I have computed the DCT of individual $8\times 8$ blocks.

Once this has been done, I have imposed that the top leftmost corner is left intact but the other elements be equalled to zero.

Then i compute the inverse-DCT on that block and use it to reconstruct my image.

The algorithm seems to work giving the following results





Given that I've ignored lots of steps in the jpeg algorithm (all the things related to huffman encoding, quantization matrix etc) why is this simple algorithm working?

Thanks.
If you compute a $8\times 8$ 2D-DCT, and keep the top left corner only, you are keeping a quantity that is proportional to the average of each  $8\times 8$ block.  This is the DC component, similar to the $0$ frequency in a Fourier transform. This works like a JPEG coding with a quantization table looking like:

$$\displaystyle \left( \begin{array}{cccc}
1 &amp; \infty &amp; \cdots &amp; \infty\\
\infty  &amp; \infty  &amp; \cdots &amp; \infty\\
\vdots  &amp; \vdots &amp;  \ddots &amp; \infty\\
\infty  &amp; \infty  &amp; \cdots &amp; \infty
\end{array}\right)$$

Performing the inverse DCT with this "kind of" quantization spreads the average value over the $8\times 8$ block. What you are doing is equivalent to performing a moving average with an $8\times 8$ uniform window and then downsampling by  $8$ in both the $x$ and $y$ directions. You compress by replacing each $64$-pixel  block by its average, resulting (effectively) in a $64$ times smaller image, and you "fake" an original size image by extrapolating the average.

However, you cannot claim a $1/64$ compression yet, because the coefficients you keep are not quantized yet, and are stored for instance on $32$-bit floating point words. Before you go into more advanced coding, you are about at a  $1/16 = 1/64\times 32/8$ compression rate.