next up previous 231
Next: Modifying an image
Up: Examples of using IMG from C
Previous: Accessing an existing image

Creating a new image

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 );
}



next up previous 231
Next: Modifying an image
Up: Examples of using IMG from C
Previous: Accessing an existing image

IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk

Copyright © 2000-2003 Council for the Central Laboratory of the Research Councils