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}...

VIPS includes a script, vips-config, which automatically outputs all the flags and libraries you need to compile a vips program. To compile this example, use:

cc `vips-config --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.


next up previous contents
Next: 3.4 Eval callbacks Up: 3. The VIPS image Previous: 3.2 Opening and closing   Contents
John Cupitt 2003-07-21