image palette's dimension reduction using matplotlib and/or numpy to create blocky image
问题 I am using iPython notebook, I have a 512x512 image that I want to 'transform' into a 'blocky' image using 'nearest' interpolation of colors in the blocks, similar to the 'mosaic' filter in Photoshop, for some further manipulation of a batch of pictures. In Photoshop, you load the image and you can set the filter to 'Mosaic', and set the 'block size' in pixels. Here there is a partial explanation about how to do it using numpy, but since I am not a numpy expert, I found a 'shortcut' that is