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

# DocumentImage.fromBuffer Method

Module: DocumentImage

## Definition

Creates an Image from the specified data buffer.

Python

    @staticmethod
    from_buffer(data: bytearray, pixel_format: PixelFormat) -> DocumentImage

Parameters

> `data` bytearray
> in A buffer that contains the image data.
> `pixel_format` PixelFormat
> in The destination pixel format to convert the input to.

Returns

> DocumentImage
> The newly created document image.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Dart

    static DocumentImage fromBuffer(Uint8List? data, PixelFormat pixelFormat)

Parameters

> `data` Uint8List
> in A buffer that contains the image data.
> `pixelFormat` PixelFormat
> in The destination pixel format to convert the input to.

Returns

> DocumentImage
> The newly created document image.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

C#

    public static DocumentImage FromBuffer(byte[] data, PixelFormat pixelFormat)

Parameters

> `data` byte[]
> in A buffer that contains the image data.
> `pixelFormat` PixelFormat
> in The destination pixel format to convert the input to.

Returns

> DocumentImage
> The newly created document image.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Java

    public static DocumentImage fromBuffer(byte[] data, PixelFormat pixelFormat) throws DocumentException

Parameters

> `data` byte[]
> in A buffer that contains the image data.
> `pixelFormat` PixelFormat
> in The destination pixel format to convert the input to.

Returns

> DocumentImage
> The newly created document image.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Swift

    public static func fromBuffer(data: [UInt8], pixelFormat: PixelFormat) throws -> DocumentImage

Parameters

> `data` [UInt8]
> in A buffer that contains the image data.
> `pixelFormat` PixelFormat
> in The destination pixel format to convert the input to.

Returns

> DocumentImage
> The newly created document image.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

C

    int id3DocumentImage_FromBuffer (
        ID3_DOCUMENT_IMAGE hDocumentImage,
        unsigned char * data,
        int dataSize,
        id3DocumentPixelFormat ePixelFormat)

Parameters

> `hDocumentImage` ID3_DOCUMENT_IMAGE
> in Handle to the DocumentImage object.
> `data` unsigned char *
> in A buffer that contains the image data.
> `dataSize` int
> in Size of the ‘data’ buffer.
> `ePixelFormat` id3DocumentPixelFormat
> in The destination pixel format to convert the input to.

Returns

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