M
= ones(8);
means to leave the original image The a_00 Fourier coefficient gives the average of the function. If we only select it we see the blocks as big pixels. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

Now we select only
the first column. It means that we can analyze perfectly the parts not
depending on the first coordinate. Then horizontal lines in each block
are preserved and vertical lines are averaged as before. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

Taking out the coefficient a_00 and leaving the rest is like subtracting the average. We only see the boundary blocks. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

We can exaggerate this effect suppressing more small frequency harmonics. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

This is selecting
the northwest triangle of size 8 in the matrix of Fourier coefficients,
this is almost one half of the coefficients, exactly 36/64=9/16. Some
artifacts appear near boundaries but the quality is not bad taking into
account that we are simply deleting coefficients everywhere. In JPEG,
near the boundary the high frequencies would not be completely lost. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

This is an
exaggeration of the previous situation. With the same code a
triangle with only 1+2+3=6 coordinates is chosen. The artifacts are now
evident but we the proportion of the coefficients is 6/64, meaning that
less than the 10% of the information is kept. Imagine the result if you
delete 90% of the pixels instead of acting on the Fourier coefficients.
The image to the right is at original size to appreciate the actual quality. 
%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%


Main program 
Function mask_image 