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

# Image.fromFile Method

Module: Image

## Definition

Creates an Image from the specified file.

Python

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

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

> Image
> The newly created image.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Dart

    static Image 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

> Image
> The newly created image.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C#

    public static Image 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

> Image
> The newly created image.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Java

    public static Image fromFile(String filepath, PixelFormat pixelFormat) throws FaceException

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

> Image
> The newly created image.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Swift

    public static func fromFile(filepath: String, pixelFormat: PixelFormat) throws -> Image

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

> Image
> The newly created image.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C

    int id3FaceImage_FromFile (
        ID3_FACE_IMAGE hImage,
        const char * filepath,
        id3FacePixelFormat ePixelFormat)

Parameters

> `hImage` ID3_FACE_IMAGE
> in Handle to the Image object.
> `filepath` const char *
> in A string that contains the name of the file from which to create the Image.
> `ePixelFormat` id3FacePixelFormat
> in The pixel format into which to convert the input image.

Returns

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