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

# DocumentImage.fromFile Method

Module: DocumentImage

## Definition

Creates an Image from the specified file.

Python

    @staticmethod
    from_file(filepath: str, pixel_format: PixelFormat) -> DocumentImage

Parameters

> `filepath` str
> in A string that contains the name of the file from which to create the Image.
> `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 fromFile(String? filepath, PixelFormat pixelFormat)

Parameters

> `filepath` String
> in A string that contains the name of the file from which to create the Image.
> `pixelFormat` 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 FromFile(string filepath, PixelFormat pixelFormat)

Parameters

> `filepath` string
> in A string that contains the name of the file from which to create the Image.
> `pixelFormat` 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 fromFile(String filepath, PixelFormat pixelFormat) throws DocumentException

Parameters

> `filepath` String
> in A string that contains the name of the file from which to create the Image.
> `pixelFormat` 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 fromFile(filepath: String, pixelFormat: PixelFormat) throws -> DocumentImage

Parameters

> `filepath` String
> in A string that contains the name of the file from which to create the Image.
> `pixelFormat` 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_FromFile (
        ID3_DOCUMENT_IMAGE hDocumentImage,
        const char * filepath,
        id3DocumentPixelFormat ePixelFormat)

Parameters

> `hDocumentImage` ID3_DOCUMENT_IMAGE
> in Handle to the DocumentImage object.
> `filepath` const char *
> in A string that contains the name of the file from which to create the Image.
> `ePixelFormat` 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.