#include "im.h"
#include "img_dim.h"

static unsigned char red[WIDTHHEIGHT*2];
static unsigned char green[WIDTHHEIGHT*2];
static unsigned char blue[WIDTHHEIGHT*2];
static unsigned char cinza[WIDTHHEIGHT];

void load(char *fname, unsigned char imagem[3*WIDTHHEIGHT])
{
 imLoadRGB(fname, red, green, blue);
 for (unsigned char *pimagem=imagem, *pred=red, *pgreen=green, *pblue=blue, *pmax=imagem+3*WIDTH*HEIGHT-1; pimagem<=pmax; *pimagem++=*pblue++, *pimagem++=*pgreen++, *pimagem++=*pred++);
}