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

# DocumentImage.fromNumpy Method

Module: DocumentImage

## Definition

Creates an Image from the specified data buffer. Supported pixel formats are grayscale formats, BGR and RGB 24bits, and BGRA. For integers format, input datatype must be UINT8.

Python

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

Parameters

> `data` bytearray
> in A numpy array containing the image data.
> `pixel_format` PixelFormat
> in The pixel format of the image.

Returns

> DocumentImage
> The newly created document image.

Exceptions

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