var glitcher = require("../glitcher")

var fs = require("fs")
var doge = fs.readFileSync("./img/doge_jump2.gif")
var gifwriter = require("writegif")
var readimage = require("readimage")

readimage(doge, function (err, dogeImage) {
  var m = glitcher.medianFrame(dogeImage.frames)
  var i = new readimage.Image(dogeImage.height, dogeImage.width)
  i.addFrame(m)
  gifwriter(i, function (err, gif) {
    fs.writeFileSync("./output/mediandoge.gif", gif)
  })
})

readimage(doge, function (err, dogeImage) {
  var m = glitcher.meanFrame(dogeImage.frames)
  var i = new readimage.Image(dogeImage.height, dogeImage.width)
  i.addFrame(m)
  console.log(glitcher.medianPixel(m))

  gifwriter(i, function (err, gif) {
    fs.writeFileSync("./output/meandoge.gif", gif)
  })
})

readimage(doge, function (err, dogeImage) {
  dogeImage.frames.forEach(function (frame) {
    glitcher.rowSort(dogeImage.width, frame.data)
  })
  gifwriter(dogeImage, function (err, gif) {
    fs.writeFileSync("./output/sorteddoge.gif", gif)
  })
})

@@ -63,53 +63,86 @@
 var 
-doge = fs.readFileSync(%22./img/doge_jump2.gif%22
+img = process.argv%5B2%5D %7C%7C %22./img/doge_jump2.gif%22%0Avar doge = fs.readFileSync(img
 )%0Ava
@@ -661,47 +661,8 @@
 e(m)
-%0A  console.log(glitcher.medianPixel(m))
 %0A%0A  

Improve avg example