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

# DocumentImage.fromRawBuffer Method

Module: DocumentImage

## Definition

Creates an Image from the specified raw data buffer.

Python

    @staticmethod
    from_raw_buffer(pixels: bytearray, width: int, height: int, stride: int, src_pixel_format: PixelFormat, dst_pixel_format: PixelFormat) -> DocumentImage

Parameters

> `pixels` bytearray
> in A buffer that contains image pixels.
> `width` int
> in The width, in pixels, of the image.
> `height` int
> in The height, in pixels, of the image.
> `stride` int
> in The stride, in pixels, of the image.
> `src_pixel_format` PixelFormat
> in The pixel format of the input image.
> `dst_pixel_format` PixelFormat
> in The pixel format into which to convert the input image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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

Dart

    static DocumentImage fromRawBuffer(Uint8List? pixels, int width, int height, int stride, PixelFormat srcPixelFormat, PixelFormat dstPixelFormat)

Parameters

> `pixels` Uint8List
> in A buffer that contains image pixels.
> `width` int
> in The width, in pixels, of the image.
> `height` int
> in The height, in pixels, of the image.
> `stride` int
> in The stride, in pixels, of the image.
> `srcPixelFormat` PixelFormat
> in The pixel format of the input image.
> `dstPixelFormat` PixelFormat
> in The pixel format into which to convert the input image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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

C#

    public static DocumentImage FromRawBuffer(byte[] pixels, int width, int height, int stride, PixelFormat srcPixelFormat, PixelFormat dstPixelFormat)

Parameters

> `pixels` byte[]
> in A buffer that contains image pixels.
> `width` int
> in The width, in pixels, of the image.
> `height` int
> in The height, in pixels, of the image.
> `stride` int
> in The stride, in pixels, of the image.
> `srcPixelFormat` PixelFormat
> in The pixel format of the input image.
> `dstPixelFormat` PixelFormat
> in The pixel format into which to convert the input image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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

Java

    public static DocumentImage fromRawBuffer(byte[] pixels, int width, int height, int stride, PixelFormat srcPixelFormat, PixelFormat dstPixelFormat) throws DocumentException

Parameters

> `pixels` byte[]
> in A buffer that contains image pixels.
> `width` int
> in The width, in pixels, of the image.
> `height` int
> in The height, in pixels, of the image.
> `stride` int
> in The stride, in pixels, of the image.
> `srcPixelFormat` PixelFormat
> in The pixel format of the input image.
> `dstPixelFormat` PixelFormat
> in The pixel format into which to convert the input image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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

Swift

    public static func fromRawBuffer(pixels: [UInt8], width: Int32, height: Int32, stride: Int32, srcPixelFormat: PixelFormat, dstPixelFormat: PixelFormat) throws -> DocumentImage

Parameters

> `pixels` [UInt8]
> in A buffer that contains image pixels.
> `width` Int32
> in The width, in pixels, of the image.
> `height` Int32
> in The height, in pixels, of the image.
> `stride` Int32
> in The stride, in pixels, of the image.
> `srcPixelFormat` PixelFormat
> in The pixel format of the input image.
> `dstPixelFormat` PixelFormat
> in The pixel format into which to convert the input image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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

C

    int id3DocumentImage_FromRawBuffer (
        ID3_DOCUMENT_IMAGE hDocumentImage,
        unsigned char * pixels,
        int pixelsSize,
        int width,
        int height,
        int stride,
        id3DocumentPixelFormat eSrcPixelFormat,
        id3DocumentPixelFormat eDstPixelFormat)

Parameters

> `hDocumentImage` ID3_DOCUMENT_IMAGE
> in Handle to the DocumentImage object.
> `pixels` unsigned char *
> in A buffer that contains image pixels.
> `pixelsSize` int
> in Size of the ‘pixels’ buffer.
> `width` int
> in The width, in pixels, of the image.
> `height` int
> in The height, in pixels, of the image.
> `stride` int
> in The stride, in pixels, of the image.
> `eSrcPixelFormat` id3DocumentPixelFormat
> in The pixel format of the input image.
> `eDstPixelFormat` id3DocumentPixelFormat
> in The pixel format into which to convert the input image.

Returns

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