#BASH with *nix commands
##Some oneliners generating PPM format pictures

Ok... this sure will not be the most popular solution, but I think it is worth being mentioned because it shows (one way) how to build raster graphics with shell commands:

    { printf 'P3\n# x.ppm\n256 128\n31\n' ; printf '%s\n' {0..31}.{0..31}.{0..31} | tr . ' ' ; } >x.ppm

Output:

![x][1]

You can add other commands to that pipe to shuffle or rearrange the pixels... letÄs try 'sort':

    { printf 'P3\n# x.ppm\n256 128\n31\n' ; printf '%s\n' {0..31}.{0..31}.{0..31} | sort | tr . ' ' ; } >y.ppm

![y][2]

Ok... that was boring!

How about some random?

    { printf 'P3\n# x.ppm\n256 128\n31\n' ; printf '%s\n' ${RANDOM}.{0..31}.{0..31}.{0..31} | sort | awk -F. '{ print $2" "$3" "$4}' ; } >z.ppm

![z][3]

If you think this is fun, read about the PBM, PGM and PPM picture file formats.

They may look like a fossil but who says that this means "no fun!"?


  [1]: http://i.stack.imgur.com/ycJFc.png
  [2]: http://i.stack.imgur.com/3d7oK.png
  [3]: http://i.stack.imgur.com/kpuQF.png