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
- targetWidthint
- The width of the bounding box in pixels. 
- targetHeightint
- The height of the bounding box in pixels. 
- backgroundColorColor32
- The 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.