Image.padCenterWithColor Method¶
Module: Image
Definition¶
Pads the image at its center with a custom background color to match the specified aspect ratio.
The function computes the smallest padded image that contains the input image while maintaining
the target aspect ratio. The original image is centered with the specified color padding.
Note
Only BGR 24-bit, RGB 24-bit, and Grayscale 8-bit images are supported.
For grayscale images, the padding color is the red component.
Image padCenterWithColor(double aspectRatio, int colorRed, int colorGreen, int colorBlue)
Parameters
aspectRatio doublein Target aspect ratio (width/height) for the padded image. Must be positive.
colorRed intin Padding color red component (0 to 255).
colorGreen intin Padding color green component (0 to 255).
colorBlue intin Padding color blue component (0 to 255).
Returns
The padded image with the specified aspect ratio.
Exceptions
An error has occurred during Face Library execution.