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

# Image.toFile Method

Module: Image

## Definition

Saves the image to the specified file.

The compression level meaning depends on the algorithm used:

- For JPEG compression, the value is the expected quality and may vary from 1 to 100.

- For JPEG2000 compression, the value is the compression rate and may vary from 1 to 512.

- For PNG compression, the value is the compression rate and may vary from 1 to 10.

- For all other formats, the value is ignored.

Python

    to_file(self, filepath: str, compression_level: float) -> None

Parameters

> `filepath` str
> in A string that contains the name of the file to which to save the image.
> `compression_level` float
> in The compression level to be applied.

Exceptions

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

Dart

    void toFile(String? filepath, double compressionLevel)

Parameters

> `filepath` String
> in A string that contains the name of the file to which to save the image.
> `compressionLevel` double
> in The compression level to be applied.

Exceptions

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

C#

    public void ToFile(string filepath, float compressionLevel)

Parameters

> `filepath` string
> in A string that contains the name of the file to which to save the image.
> `compressionLevel` float
> in The compression level to be applied.

Exceptions

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

Java

    public void toFile(String filepath, float compressionLevel) throws FaceException

Parameters

> `filepath` String
> in A string that contains the name of the file to which to save the image.
> `compressionLevel` float
> in The compression level to be applied.

Exceptions

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

Swift

    public func toFile(filepath: String, compressionLevel: Float) throws

Parameters

> `filepath` String
> in A string that contains the name of the file to which to save the image.
> `compressionLevel` Float
> in The compression level to be applied.

Exceptions

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

C

    int id3FaceImage_ToFile (
        ID3_FACE_IMAGE hImage,
        const char * filepath,
        float compressionLevel)

Parameters

> `hImage` ID3_FACE_IMAGE
> in Handle to the Image object.
> `filepath` const char *
> in A string that contains the name of the file to which to save the image.
> `compressionLevel` float
> in The compression level to be applied.

Returns

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