next up previous contents
Next: 3.8.1 How it works Up: 3. The VIPS image Previous: 3.7 Error handling   Contents


3.8 Joining operations together

VIPS lets you join image processing operations together so that they behave as a single unit. Figure 3.5 shows the definition of the function im_Lab2disp() from the VIPS library. This function converts an image in CIE  $L^{*}a^{*}b^{*}$ colour space to an RGB image for a monitor. The monitor characteristics (gamma, phosphor type, etc.) are described by the im_col_display structure, see the man page for im_col_XYZ2rgb().

Figure 3.5: Two image-processing operations joined together
\begin{figure}\begin{quote}
\begin{verbatim}int
im_Lab2disp( IMAGE *in, IMAGE...
... disp ) )
return( -1 );return( 0 );
}\end{verbatim}
\end{quote}
\end{figure}

The special "p" mode (for partial) used to open the image descriptor used as the intermediate image in this function `glues' the two operations together. When you use im_Lab2disp(), the two operations inside it will execute together, no extra storage is necessary for the intermediate image (t1 in this example). This is important if you want to process images larger than the amount of RAM you have on your machine.

As an added bonus, if you have more than one CPU in your computer, the work will be automatically spread across the processors for you. You can control this parallelisation with the IM_CONCURRENCY environment variable, see the man page for im_generate().



Subsections
next up previous contents
Next: 3.8.1 How it works Up: 3. The VIPS image Previous: 3.7 Error handling   Contents
John Cupitt 2004-11-02