Method ResizeBox
ResizeBox(int, int, Color32)
Resizes the image to fit within the specified box, adding padding with the given background color to preserve aspect ratio.
public ImageBuffer ResizeBox(int targetWidth, int targetHeight, Color32 backgroundColor)
Parameters
targetWidth
intThe width of the bounding box in pixels.
targetHeight
intThe height of the bounding box in pixels.
backgroundColor
Color32The background color used for padding.
Returns
- ImageBuffer
A new ImageBuffer containing the resized and padded image.
Exceptions
- InvalidOperationException
Thrown if the image resizing operation fails.