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
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()
.
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()
.