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
targetWidthintThe width of the bounding box in pixels.
targetHeightintThe height of the bounding box in pixels.
backgroundColorColor32The 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.
- ObjectDisposedException
Thrown if this instance has been disposed.