Aether Utilities Aether Utilities
Aether Utilities Aether Utilities
DocFX + Singulink = ♥

Search Results for

    Edit this page

    Class ImageExtensions

    Namespace
    AetherUtils.Core.Extensions
    Assembly
    AetherUtils.Core.dll
    Provides extension methods for manipulating Image objects.
    [UsedImplicitly]
    public static class ImageExtensions
    Inheritance
    object
    ImageExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()

    Methods

    IsValidImage(string)

    Get a value indicating if the image specified by the filePath is a valid image file.
    [UsedImplicitly]
    public static bool IsValidImage(this string filePath)

    Parameters

    filePath string
    The file path to an image file.

    Returns

    bool
    true if the image was valid; false otherwise.

    Exceptions

    FormatException
    If the image specified by filePath was not in the correct format.
    FileNotFoundException
    If the file specified by filePath was not found.

    ResizeImage(Image, int, int)

    Resize the Image to the specified width and height.
    [UsedImplicitly]
    public static Image ResizeImage(this Image image, int newWidth, int newHeight)

    Parameters

    image Image
    The Image to resize.
    newWidth int
    The width to resize to.
    newHeight int
    The height to resize to.

    Returns

    Image
    The resized Image.

    Exceptions

    ArgumentNullException
    If image was null.
    InvalidOperationException
    If the newWidth or newHeight was less than 0.

    ResizeImageScaled(Image, float, float)

    Resize the image to be the desired width and height while attempting to maintain the aspect ratio.
    [UsedImplicitly]
    public static Image ResizeImageScaled(this Image image, float desiredWidth, float desiredHeight)

    Parameters

    image Image
    The Image to resize.
    desiredWidth float
    The desired width of the new image.
    desiredHeight float
    The desired height of the new image.

    Returns

    Image
    The scaled Image.

    Exceptions

    ArgumentNullException
    If image was null.
    InvalidOperationException
    If the desiredWidth or desiredHeight was less than 0.

    ToByteArray(Image)

    Convert an Image into a byte array.
    [UsedImplicitly]
    public static byte[] ToByteArray(this Image image)

    Parameters

    image Image
    The image to convert.

    Returns

    byte[]
    A byte array representing the image.

    Exceptions

    ArgumentNullException
    If the image was null.
    (c) 2024 Ethan Hann. All rights reserved.