When you resize an image down to a very small size, it looks very blocky when you scale the pixels back up individually.
In extreme cases, as above, you can no longer reconstruct the original image, as too much information has been lost. Your task is to build a program that will imagine what the original, unscaled image might have looked like in extreme cases such as this one, where the picture has been reduced to a simple palette.
Your program will take an uncompressed bitmap image with three 8-bit RGB channels (with maximum dimensions 16 pixels on each side), and output a second image that produces the original image when scaled down using an average filter (equivalent to GIMP's "Linear" option).
The output image should have the same aspect ratio as the original and have an exact multiple of pixels, to make average-filtering easier. It should also be at least 50 times the size of the original image on each dimension.