Class ImageUtils

Summary description for wwImaging.

public static class ImageUtils : object

Class Members



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)

public static Bitmap AdjustImageToRatio(Byte[] imageContent,     decimal ratio,     int resizeWidth,     int resizeHeight)


Tries to return an image format

public static ImageFormat GetImageFormatFromFilename(string filename)


Returns the image media type for a give file extension based on a filename or url passed in.

public static string GetImageMediaTypeFromFilename(string file)


If the image contains image rotation Exif data, apply the image rotation and remove the Exif data. Optionally also allows for image resizing in the same operation.

public static void NormalizeJpgImageRotation(string imageFile,     int imageQuality,     int width,     int height)


Creates a resized bitmap from an existing image on disk. Resizes the image by creating an aspect ratio safe image. Image is sized to the larger size of width height and then smaller size is adjusted by aspect ratio.

Image is returned as Bitmap - call Dispose() on the returned Bitmap object

public static Bitmap ResizeImage(string filename,     int width,     int height,     InterpolationMode mode)

public static Bitmap ResizeImage(Byte[] data,     int width,     int height,     InterpolationMode mode)

public static bool ResizeImage(string filename,     string outputFilename,     int width,     int height,     InterpolationMode mode,     int jpegCompressionMode)

public static Bitmap ResizeImage(Bitmap bmp,     int width,     int height,     InterpolationMode mode)


Rotates an image and writes out the rotated image to a file.

public static bool RoateImage(string filename,     string outputFilename,     RotateFlipType type,     int jpegCompressionMode)

public static Byte[] RoateImage(Byte[] data,     RotateFlipType type)


Saves a jpeg BitMap to disk with a jpeg quality setting. Does not dispose the bitmap.

public static bool SaveJpeg(Bitmap bmp,     string outputFileName,     long jpegQuality)

public static bool SaveJpeg(Bitmap bmp,     Stream imageStream,     long jpegQuality)


Opens the image and writes it back out, stripping any Exif data

public static void StripJpgExifData(string imageFile,     int imageQuality)


A quick lookup for getting image encoders


Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 2019 • Updated: 06/23/19
Comment or report problem with topic