next up previous contents
Next: 3.4 Eval callbacks Up: 3. The VIPS image Previous: 3.2 Opening and closing   Contents


3.3 Examples

As an example, figure 3.3 will print the width and height of an image stored on disc.

Figure 3.2: Print width and height of an image
\begin{figure}\begin{quote}
\begin{verbatim}...

To compile this example, use:

cc `pkg-config vips-7.10 --cflags --libs` myfunc.c

As a slightly more complicated example, figure 3.3 will calculate the photographic negative of an image.

Figure 3.3: Find photographic negative
\begin{figure}\begin{quote}
\begin{verbatim}...

The call to im_updatehist() adds a line to the Hist field in out, noting the invocation of this program, its arguments, and the time and date at which it was run. It is the application's responsibility to keep Hist up-to-date -- the image processing functions do not use this field. You may also find im_histlin() helpful. It has type:

void im_histlin( IMAGE *im, 
  const char *fmt, ... )

It formats its arguments as printf() and appends the string formed to the Hist string.



John Cupitt 2004-11-02