Back to Aurora Vision Library Lite website

You are here: Start » Image » Image IO » LoadImageFromBuffer

LoadImageFromBuffer


Header: AVL.h
Namespace: avl

Loads a single image from a file stored in memory.

Applications: Use this filter when you received an image file through I/O communication, e.g. through a TcpIp connection.

Syntax

void avl::LoadImageFromBuffer
(
	const avl::ByteBuffer& inBuffer,
	int inOffset,
	atl::Optional<int> inLength,
	bool inLoadAlphaChannel,
	avl::Image& outImage
)

Parameters

Name Type Default Description
Input value inBuffer const ByteBuffer& Source buffer containing image file data
Input value inOffset int 0 Image data start position in source buffer
Input value inLength Optional<int> NIL Image data length in source buffer
Input value inLoadAlphaChannel bool Whether to load the alpha channel (if exists) as an additional image channel
Output value outImage Image& Output image

Description

This function loads an Image from a common format file similarly to LoadImage, but instead of accessing the file system it uses only the memory by loading the file content from ByteBuffer.

The operation loads an image from a file in one of the standard image file formats. Currently the filter supports the following formats:

  • BMP (*.bmp),
  • JPEG (*.jpg, *jpeg),
  • PNG (*.png),
  • PNM (*.pbm, *.pgm, *.ppm, *.pnm),
  • TIFF (*.tif, *.tiff).

The format of the image file is recognized automatically based on the file header.

The resulting outImage will be three-channel image of UInt8 pixel type, or sometimes of UInt16 pixel type for 16-bit depth images of supported formats (PNG, TIFF).

Errors

List of possible exceptions:

Error type Description
IoError Reading beyond the end of the byte buffer in LoadImageFromBuffer.

See Also

  • LoadImage – Loads a single image from a file.