

#include "image.h"

int main(int argc, char **argv)
{
  FloatImage in, out;
  int x, y;
  int fact;


  if (argc != 2  ||  (fact = atol(argv[1])) <= 0) {
    fprintf(stderr, "upsample factor < in > out\n");
    return 0;
  }  

  in   = imLoadF(IMAGE_FLOAT, stdin);
  out  = imNew(IMAGE_FLOAT, fact*imGetWidth(in) + 1, fact*imGetHeight(in) + 1);
  
  for (y=0; y<imGetHeight(in); y++)
    for (x=0; x<imGetWidth(in); x++)
      imRef(out, x*fact + 1, y*fact + 1) = imRef(in, x, y);

  imSaveF(out, stdout);

  return 0;  
}
