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

# Image.downscale Method

Module: Image

## Definition

Downscales the image in-place so that its maximum dimension is equal to the given maximum size, while preserving the aspect ratio.

Note

If the maximum dimension is already smaller than the given maximum size, the function does nothing and the scaling ration returned is 1.

Python

    downscale(self, max_size: int) -> float

Parameters

> `max_size` int
> in Maximum image size, in pixels. The value must be greater than 0.

Returns

> `float`
> The scaling ratio applied to the image. Range is ]0:1].

Exceptions

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

Dart

    double downscale(int maxSize)

Parameters

> `maxSize` int
> in Maximum image size, in pixels. The value must be greater than 0.

Returns

> `double`
> The scaling ratio applied to the image. Range is ]0:1].

Exceptions

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

C#

    public float Downscale(int maxSize)

Parameters

> `maxSize` int
> in Maximum image size, in pixels. The value must be greater than 0.

Returns

> `float`
> The scaling ratio applied to the image. Range is ]0:1].

Exceptions

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

Java

    public float downscale(int maxSize) throws FaceException

Parameters

> `maxSize` int
> in Maximum image size, in pixels. The value must be greater than 0.

Returns

> `float`
> The scaling ratio applied to the image. Range is ]0:1].

Exceptions

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

Swift

    public func downscale(maxSize: Int32) throws -> Float

Parameters

> `maxSize` Int32
> in Maximum image size, in pixels. The value must be greater than 0.

Returns

> `Float`
> The scaling ratio applied to the image. Range is ]0:1].

Exceptions

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

C

    int id3FaceImage_Downscale (
        ID3_FACE_IMAGE hImage,
        int maxSize,
        float * scaleRatio)

Parameters

> `hImage` ID3_FACE_IMAGE
> in Handle to the Image object.
> `maxSize` int
> in Maximum image size, in pixels. The value must be greater than 0.
> `scaleRatio` float *
> out The scaling ratio applied to the image. Range is ]0:1].

Returns

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