This example (flat.c) shows how to create a new image. It also sets all the elements of the image to 1.0.
#include <stdio.h>
#include "img.h"
void flat_(int *istat)
{
/* Local variables: */
float *ip;
int i;
/* Create a new image. */
imgNew( "out", 416, 578, &ip, istat );
/* Set all its elements to the value 1.0. */
for( i=0; i < 416*578; i++ ) {
ip[i] = 1.0f;
}
/* Free the new image. */
imgFree( "out", istat );
}
IMG Simple Image Data Access