downscale method

double downscale(
  1. int maxSize
)

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.

param maxSize Maximum image size, in pixels. The value must be greater than 0. return The scaling ratio applied to the image. Range is )0:1). throws DocumentException An error has occurred during Document Library execution.

Implementation

double downscale(int maxSize) {
  Pointer<Float> pScaleRatio = calloc();
  try {
    var err = documentSDK.id3DocumentImage_Downscale(_pHandle.value, maxSize, pScaleRatio);
    if (err != DocumentError.success.value) {
      throw DocumentException(err);
    }
    final vScaleRatio = pScaleRatio.value;
    return vScaleRatio;
  } finally {
    calloc.free(pScaleRatio);
  }
}