Adjusts an image to a specific aspect ratio by clipping from the center outward - essentially capturing the center to fit the width/height of the aspect ratio.
public static Bitmap AdjustImageToRatio(Stream imageStream, decimal ratio, int resizeWidth, int resizeHeight)
Return Value
Bitmap image - make sure to dispose this image
Parameters
imageStream
Stream to an image
ratio
Aspect ratio default is 16:9
resizeWidth
Optionally resize with to this width (if larger than height)
resizeHeight
Optionally resize to this height (if larger than width)
Overloads:
See also:
Class ImageUtils© West Wind Technologies, 1996-2020 • Updated: 07/15/20
Comment or report problem with topic