Flip It, Flop It, Mean It

Bash (+ImageMagick), 64+1 = 65 bytes

C=convert;$C a -flip b;$C a -flop c;$C c -flip d;$C * -average e

Right tool for the job.

Must be run in a directory containing a single file a that contains the PPM data to transform. Since this filename is significant, I've added one byte to the byte count.

PNG thumbnail outputs (not sure why this is necessary because they're all the same anyway, but the question says so, so...):

penguin quintopia peter minibits

Thanks to nneonneo for saving 2 bytes!


Matlab, 106 82 80 bytes

i=imread(input(''))/4;for k=1:2;i=i+flipdim(i,k);end;imwrite(i,'p3.pnm','e','A')

The image is loaded as n*m*3 matrix. Then we flip the matrix and added to itself for both axis, and write it again to a file.


I couldn't find a place to upload text files so big, so here are the PNG versions:


Mathematica, 86 84 bytes

Thanks to DavidC for the advice. (saves 2 bytes)

Export[#2,⌊Mean@Join[#,(r=Reverse)/@#]&@{#,r/@#}&@Import[#,"Data"]⌋~Image~"Byte"]&

The first and second parameters are the paths to the input and output images, respectively.


Test cases

f=%; (assign the function to symbol f)
f["penguin.pnm","penguin2.pnm"]
f["quintopia.pnm","quintopia2.pnm"]
f["peter.pnm","peter2.pnm"]

Result

(PNG versions of the images are uploaded below)

Import["penguin2.pnm"]

Import["quintopia2.pnm"]

Import["peter2.pnm"]