

#include <stdio.h>
#include "image.h"

static char *usage = "imstrip < image-file > bytes\n";

int main(int argc)
{
  PtrImage img;
  int size;

  if (argc > 1) {
    fprintf(stderr, usage);
    return 0;
  }
  
  img = imLoadF(IMAGE_ANY, stdin);

  switch (imGetType(img)) {
    case IMAGE_GRAY: size = sizeof(uchar); break;
    case IMAGE_RGB:  size = sizeof(RGB);   break;

    default: size = 0;
  }

  if (img != NULL  &&  size) {
    fwrite((void *)imGetStore(img), size, imGetStoreLen(img), stdout);
  }

  return 0;
}
