---
name: "GetImage"
section: "3"
platform: "linux"
package: "libvolpack1-dev"
version: "1.0b3-10"
release: "Debian 13 (Trixie)"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/GetImage/3"
---

# GetImage(3)

get a field of the intermediate image

## NAME

vpGetImage - get a field of the intermediate image

## SYNOPSIS

\#include \<volpack.h\>

vpResult

**vpGetImage(***vpc, image, width, height, scan\_bytes,* *pixel\_type, image\_type***)**

-

  vpContext \**vpc;*

-

  void \**image;*

-

  int *width, height;*

-

  int *scan\_bytes;*

-

  int *pixel\_type, image\_type;*

## ARGUMENTS

- *vpc*

  VolPack context from **vpCreateContext.**

- *image*

  2D array for storing result image.

- *width*

  Width of array in pixels.

- *height*

  Height of array in pixels.

- *scan\_bytes*

  Number of bytes per scanline in array.

- *pixel\_type*

  Code indicating the format of each pixel in the array.

- *image\_type*

  Code indicating the source of the image data (VP\_IMAGE\_BUFFER or VP\_SHADOW\_BUFFER).

## DESCRIPTION

This is a debugging function.  It is used to retrieve the contents of one of the temporary rendering buffers used during rendering, namely the intermediate image or the shadow buffer.  Rendering consists of two stages: the volume is resampled and composited into the intermediate image to produce a distorted volume rendering, and then the intermediate image is warped into the final image.  If shadows are enabled then the shadow buffer is used during the first stage to incrementally compute which voxels are illuminated by the light source. This function returns images produced during the first stage, before the final warp.

This function may be called after a call to one of the rendering routines (see vpRenderRawVolume(3)).  If the *image\_type* argument is VP\_IMAGE\_BUFFER then data will be copied from the intermediate image.  The *pixel\_type* argument specifies what information to copy and the format for storing the data in the output array.  The possible values for *pixel\_type* are the same as for the *pixel\_type* argument to **vpSetImage.**  For instance, use VP\_LUMINANCE to extract the grayscale intensity (assuming the current shader produces grayscale pixels).

If the *image\_type* argument is VP\_SHADOW\_BUFFER then data will be copied from the shadow buffer.  The only valid option for *pixel\_type* is VP\_ALPHA, since no color information is stored in the shadow buffer.

See **vpSetImage** for details on the pixel formats, the layout of the output array, and the remaining arguments.

To find the required size for the result array, use **vpGeti** with the VP\_INTERMEDIATE\_WIDTH and VP\_INTERMEDIATE\_HEIGHT options (when *image\_type* is VP\_IMAGE\_BUFFER) or the VP\_SHADOW\_WIDTH and VP\_SHADOW\_HEIGHT options (when *image\_type* is VP\_SHADOW\_BUFFER).

## ERRORS

The normal return value is VP\_OK.  The following error return values are possible:

- VPERROR\_BAD\_SIZE

  The destination array size is incorrect or there is no intermediate image.

- VPERROR\_BAD\_OPTION

  The *field* argument is invalid.

## SEE ALSO

[VolPack(3)](/VolPack/3.md), vpRenderRawVolume(3), vpGeti(3)
