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

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

- 3.8.1 How it works
- 3.8.2 Pitfalls with partials
- 3.8.3 Non-image output
- 3.8.4 Calculating twice
- 3.8.5 Blocking computation
- 3.8.6 Limitations

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