Note that you must call hapi.renderTextureToImage first for this method call to make sense.
Also note that this function will do all the work of extracting and compositing the image into a memory buffer but will not return to you that buffer, only its size. Use the returned size to allocated a sufficiently large buffer and call hapi.getImageMemoryBuffer to fill your buffer with the just extracted image.
Usage ¶
extractImageToMemory(session
: hapi.Session, material_node_id
: int
, image_file_format_name
: str
, image_planes
: str
) → int
Extract a rendered image to memory.
session
The session of Houdini you are interacting with. See hapi.Session for more on sessions. Pass None to just use the default in-process session.
material_node_id
The material node id.
image_file_format_name
The image file format name you wish the image to be extracted as. You can leave this parameter None to get the image in the original format if it comes from another texture file or in the default HAPI format, which is hapi.DEFAULT_IMAGE_FORMAT_NAME if the image is generated.
You can get some of the very common standard image file format names from HAPI_Common.h under the “Defines” section.
You can also get a list of all supported file formats (and the exact names this parameter expects) by using hapi.getSupportedImageFileFormats. This list will include custom file formats you created via custom DSOs (see HDK docs about IMG_Format). You will get back a list of hapi.ImageFileFormat. This parameter expects the hapi.ImageFileFormat.nameSH of a given image file format.
image_planes
The image planes you wish to extract into the file. Multiple image planes should be separated by spaces.
Returns buffer_size as a int
.