CaptureImage.downscaleTo Method

Module: CaptureImage

Definition

Downscales the image so that its maximum dimension equals 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 returned scale ratio is 1.

downscale_to(self, dst_capture_image: CaptureImage, max_size: int) -> float

Parameters

dst_capture_image CaptureImage
in Destination image.

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

An error has occurred during Devices Library execution.
double downscaleTo(CaptureImage dstCaptureImage, int maxSize)

Parameters

dstCaptureImage CaptureImage
in Destination image.

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

An error has occurred during Devices Library execution.
public float DownscaleTo(CaptureImage dstCaptureImage, int maxSize)

Parameters

dstCaptureImage CaptureImage
in Destination image.

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

An error has occurred during Devices Library execution.
public float downscaleTo(CaptureImage dstCaptureImage, int maxSize) throws DevicesException

Parameters

dstCaptureImage CaptureImage
in Destination image.

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

An error has occurred during Devices Library execution.
int id3DevicesCaptureImage_DownscaleTo (
    ID3_DEVICES_CAPTURE_IMAGE hCaptureImage,
    ID3_DEVICES_CAPTURE_IMAGE hDstCaptureImage,
    int maxSize,
    float * scaleRatio)

Parameters

in Handle to the CaptureImage object.

hDstCaptureImage ID3_DEVICES_CAPTURE_IMAGE
in Destination image.

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 id3DevicesError file for the list of possible error codes.