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

# DocumentImage Class

Namespace: id3.Document

## Definition

Represents a document image.
Python

    class DocumentImage

Dart

    class DocumentImage implements Finalizable

C#

    public partial class DocumentImage

Java

    public class DocumentImage implements AutoCloseable, Serializable

Swift

    public class DocumentImage

C

    typedef struct id3DocumentImage *ID3_DOCUMENT_IMAGE;

## Usage

Python

    documentImageInstance = DocumentImage()
    # ...

Explicit destruction

    # ...
    del documentImageInstance

Dart

    final documentImageInstance = sdk.DocumentImage();
    // ...

Explicit destruction

    // ...
    documentImageInstance.dispose()

C#

    using (var documentImageInstance = new DocumentImage())
    {
       // ...
    }

Explicit destruction

    var documentImageInstance = new DocumentImage()
    // ...
    documentImageInstance.Dispose()

Java

    try (DocumentImage documentImageInstance = new DocumentImage()) {
    // ...
    }

Explicit destruction

    DocumentImage documentImageInstance = new DocumentImage();
    // ...
    documentImageInstance.close();

Swift

    private var documentImageInstance: DocumentImage? = nil
    documentImageInstance = try DocumentImage()

C

    ID3_DOCUMENT_IMAGE hDocumentImage{};
    int err = id3DocumentImage_Initialize(&hDocumentImage);
    if (err == ID3_SUCCESS) {
        // ...
        id3DocumentImage_Dispose(&hDocumentImage);
    }

## Properties

Name | Type | Description
--- | --- | ---
data | byte[] | Raw data buffer of the image.
height | int | Height in pixels.
pixelDepth | int | Pixel depth.
pixelFormat | PixelFormat | Pixel format.
stride | int | Stride in bytes.
width | int | Width in pixels.

## Static Methods

Name | Description
--- | ---
fromBuffer | Creates an Image from the specified data buffer.
fromFile | Creates an Image from the specified file.
fromNumpy | 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.
fromRawBuffer | Creates an Image from the specified raw data buffer.
fromYuvPlanes | Creates an Image from the specified YUV planes.
set | Sets the Image object fields.

## Methods

Name | Description
--- | ---
clone | Clones the DocumentImage object.
compare | Computes the difference with another image.
correctGamma | Applies a gamma correction to the image.
crop | Crop a rectangular region of interest in the image according to the given bounds.
downscale | Downscales the image in-place so that its maximum dimension is equal to the given maximum size, while preserving the aspect ratio.
downscaleTo | Downscales the image so that its maximum dimension equals the given maximum size, while preserving the aspect ratio.
extractRoi | Extracts a region of interest in the image according to the given bounds.
extractRoiWithColor | Extracts a region of interest in the image according to the given bounds.
flip | Flips the image in-place.
flipTo | Flips the image.
getPixels | Gets a pointer to the image pixels.
pad | Add padding around the image
reallocate | Reallocates the internal memory of the Image from parameters.
resize | Resizes the image in-place to the required width and height.
resizeTo | Resizes the image to the specified width and height.
rotate | Rotates the image in-place to the specified angle.
rotateTo | Rotates the image to the specified angle.
toBuffer | Exports the image to a buffer.
toBufferObject | Copies the image to a buffer in the specified format.
toFile | Saves the image to the specified file.
toNumpy | Exports the image to a numpy array (Python only)
toRawBuffer | Copies image pixels in the specified format into a buffer.
transpose | Transposes the image object.