Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Image.toBufferObject Method

Module: Image

## Definition

Copies the image to a buffer in the specified format.

The compression level meaning depends on the algorithm used:

- For JPEG compression, the value is the expected quality and may vary from 1 to 100.

- For JPEG2000 compression, the value is the compression rate and may vary from 1 to 512.

- For PNG compression, the value is the compression rate and may vary from 1 to 10.

- For all other formats, the value is ignored.

Python

    to_buffer_object(self, image_format: ImageFormat, compression_level: float, buffer: ImageBuffer) -> None

Parameters

> `image_format` ImageFormat
> in The output image format.
> `compression_level` float
> in The compression level to be applied.
> `buffer` ImageBuffer
> in The image buffer that receives the image data.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Dart

    void toBufferObject(ImageFormat imageFormat, double compressionLevel, ImageBuffer buffer)

Parameters

> `imageFormat` ImageFormat
> in The output image format.
> `compressionLevel` double
> in The compression level to be applied.
> `buffer` ImageBuffer
> in The image buffer that receives the image data.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C#

    public void ToBufferObject(ImageFormat imageFormat, float compressionLevel, ImageBuffer buffer)

Parameters

> `imageFormat` ImageFormat
> in The output image format.
> `compressionLevel` float
> in The compression level to be applied.
> `buffer` ImageBuffer
> in The image buffer that receives the image data.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Java

    public void toBufferObject(ImageFormat imageFormat, float compressionLevel, ImageBuffer buffer) throws FaceException

Parameters

> `imageFormat` ImageFormat
> in The output image format.
> `compressionLevel` float
> in The compression level to be applied.
> `buffer` ImageBuffer
> in The image buffer that receives the image data.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Swift

    public func toBufferObject(imageFormat: ImageFormat, compressionLevel: Float, buffer: ImageBuffer) throws

Parameters

> `imageFormat` ImageFormat
> in The output image format.
> `compressionLevel` Float
> in The compression level to be applied.
> `buffer` ImageBuffer
> in The image buffer that receives the image data.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C

    int id3FaceImage_ToBufferObject (
        ID3_FACE_IMAGE hImage,
        id3FaceImageFormat eImageFormat,
        float compressionLevel,
        ID3_FACE_IMAGE_BUFFER hBuffer)

Parameters

> `hImage` ID3_FACE_IMAGE
> in Handle to the Image object.
> `eImageFormat` id3FaceImageFormat
> in The output image format.
> `compressionLevel` float
> in The compression level to be applied.
> `hBuffer` ID3_FACE_IMAGE_BUFFER
> in The image buffer that receives the image data.

Returns

> `int`
> An error code.
> See id3FaceError file for the list of possible error codes.