Gembox.Imaging
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Image Class

    Namespace:
    GemBox.Imaging
    Assembly:
    GemBox.Imaging.dll

    Represents an image that consists of the pixels data and its attributes.

    • C#
    • VB.NET
    public sealed class Image : IDisposable
    Public NotInheritable Class Image
        Implements IDisposable
    Inheritance:
    System.Object
    Image
    Implements
    System.IDisposable

    Constructors

    Image(Image, Image[])

    Initializes a new instance of the Image class with a specified collection of image frames.

    • C#
    • VB.NET
    public Image(Image image, params Image[] images)
    Public Sub New(image As Image, ParamArray images As Image())
    Parameters
    image
    Image

    The first image that contain frames to be included in the image.

    images
    Image[]

    A list containing the images that contain frames to be included in the image.

    Image(ImageFrame, ImageFrame[])

    Initializes a new instance of the Image class with a specified collection of image frames.

    • C#
    • VB.NET
    public Image(ImageFrame frame, params ImageFrame[] frames)
    Public Sub New(frame As ImageFrame, ParamArray frames As ImageFrame())
    Parameters
    frame
    ImageFrame

    The first frame to be included in the image.

    frames
    ImageFrame[]

    A list containing the frames to be included in the image.

    Image(IEnumerable<Image>, Boolean)

    Initializes a new instance of the Image class with a specified collection of image frames.

    • C#
    • VB.NET
    public Image(IEnumerable<Image> images, bool disposeImagesAfterLoading = false)
    Public Sub New(images As IEnumerable(Of Image), disposeImagesAfterLoading As Boolean = False)
    Parameters
    images
    System.Collections.Generic.IEnumerable<Image>

    A list containing the images that contain frames to be included in the image.

    disposeImagesAfterLoading
    System.Boolean

    Disposes the given images after loading of frames are completed. In doing so this prevents loading all images till the end and handles memory more efficiently.

    Image(IEnumerable<ImageFrame>)

    Initializes a new instance of the Image class with a specified collection of image frames.

    • C#
    • VB.NET
    public Image(IEnumerable<ImageFrame> frames)
    Public Sub New(frames As IEnumerable(Of ImageFrame))
    Parameters
    frames
    System.Collections.Generic.IEnumerable<ImageFrame>

    A list containing the frames to be included in the image.

    Properties

    DpiX

    Gets the horizontal dots per inch (dpi) of the image or System.Double.NaN.

    • C#
    • VB.NET
    public double DpiX { get; }
    Public ReadOnly Property DpiX As Double
    Property Value
    System.Double

    The horizontal dots per inch (dpi) of the image; that is, the dots per inch (dpi) along the x-axis.

    DpiY

    Gets the vertical dots per inch (dpi) of the image or System.Double.NaN.

    • C#
    • VB.NET
    public double DpiY { get; }
    Public ReadOnly Property DpiY As Double
    Property Value
    System.Double

    The vertical dots per inch (dpi) of the image; that is, the dots per inch (dpi) along the y-axis.

    Frames

    Gets the image frames contained in the image.

    • C#
    • VB.NET
    public ImageFrameCollection Frames { get; }
    Public ReadOnly Property Frames As ImageFrameCollection
    Property Value
    ImageFrameCollection

    The image frames contained in the image.

    Height

    Gets the height of the image in pixels.

    • C#
    • VB.NET
    public int Height { get; }
    Public ReadOnly Property Height As Integer
    Property Value
    System.Int32

    The height of the image in pixels.

    Metadata

    Gets the metadata associated with the image.

    • C#
    • VB.NET
    public ImageMetadata Metadata { get; }
    Public ReadOnly Property Metadata As ImageMetadata
    Property Value
    ImageMetadata

    The metadata associated with the image.

    Width

    Gets the width of the image in pixels.

    • C#
    • VB.NET
    public int Width { get; }
    Public ReadOnly Property Width As Integer
    Property Value
    System.Int32

    The width of the image in pixels.

    Methods

    ApplyFilter(Action<FilterBuilder>)

    Applies a filter.

    • C#
    • VB.NET
    public void ApplyFilter(Action<FilterBuilder> configureFilter)
    Public Sub ApplyFilter(configureFilter As Action(Of FilterBuilder))
    Parameters
    configureFilter
    System.Action<FilterBuilder>

    A delegate to configure the filter.

    Crop(Int32, Int32, Int32, Int32)

    Crops the image to the given position and size.

    • C#
    • VB.NET
    public void Crop(int x, int y, int width, int height)
    Public Sub Crop(x As Integer, y As Integer, width As Integer, height As Integer)
    Parameters
    x
    System.Int32

    The horizontal position of cropping.

    y
    System.Int32

    The vertical position of cropping.

    width
    System.Int32

    Width of the crop area.

    height
    System.Int32

    Height of the crop area.

    Dispose()

    Releases all resources used by the image.

    • C#
    • VB.NET
    public void Dispose()
    Public Sub Dispose

    Load(Stream)

    Loads an image from the specified stream.

    • C#
    • VB.NET
    public static Image Load(Stream stream)
    Public Shared Function Load(stream As Stream) As Image
    Parameters
    stream
    System.IO.Stream

    The stream from which to load an image.

    Returns
    Image

    A loaded image.

    Exceptions
    System.ArgumentNullException

    stream is null.

    Load(String)

    Loads an image from a file with the specified path.

    • C#
    • VB.NET
    public static Image Load(string path)
    Public Shared Function Load(path As String) As Image
    Parameters
    path
    System.String

    The file path from which to load an image.

    Returns
    Image

    A loaded image.

    Exceptions
    System.ArgumentNullException

    path is null.

    Resize(Nullable<Int32>, Nullable<Int32>)

    Resizes the image to the given size.

    • C#
    • VB.NET
    public void Resize(int? width, int? height)
    Public Sub Resize(width As Integer?, height As Integer?)
    Parameters
    width
    System.Nullable<System.Int32>

    Target width of the resulting image. If null then this will be calculated by aspect ratio.

    height
    System.Nullable<System.Int32>

    Target height of the resulting image. If null then this will be calculated by aspect ratio.

    Exceptions
    System.ArgumentNullException

    Thrown when width and height are both null.

    RotateFlip(RotateFlipType)

    Rotates and flips the image by the given enum.

    • C#
    • VB.NET
    public void RotateFlip(RotateFlipType rotateFlipType)
    Public Sub RotateFlip(rotateFlipType As RotateFlipType)
    Parameters
    rotateFlipType
    RotateFlipType

    The rotate flip type to perform rotation and flipping.

    Save(Stream, ImageFileFormat)

    Saves the image to the specified stream with the given file format.

    • C#
    • VB.NET
    public void Save(Stream stream, ImageFileFormat fileFormat)
    Public Sub Save(stream As Stream, fileFormat As ImageFileFormat)
    Parameters
    stream
    System.IO.Stream

    The stream in which to save the image.

    fileFormat
    ImageFileFormat

    The file format in which to save the image.

    Exceptions
    System.ArgumentNullException

    stream is null.

    Save(Stream, SaveOptions)

    Saves the image to the specified stream.

    • C#
    • VB.NET
    public void Save(Stream stream, SaveOptions options)
    Public Sub Save(stream As Stream, options As SaveOptions)
    Parameters
    stream
    System.IO.Stream

    The stream in which to save the image.

    options
    SaveOptions

    The saving options which can be used to define settings for save operation.

    Exceptions
    System.ArgumentNullException

    stream or options is null.

    Save(String)

    Saves the image to the specified file path.

    • C#
    • VB.NET
    public void Save(string path)
    Public Sub Save(path As String)
    Parameters
    path
    System.String

    The file path to which to save the image.

    Exceptions
    System.ArgumentNullException

    path is null.

    Save(String, ImageFileFormat)

    Saves the image to the specified file path.

    • C#
    • VB.NET
    public void Save(string path, ImageFileFormat fileFormat)
    Public Sub Save(path As String, fileFormat As ImageFileFormat)
    Parameters
    path
    System.String

    The file path in which to save the image.

    fileFormat
    ImageFileFormat

    The file format in which to save the image.

    Exceptions
    System.ArgumentNullException

    path is null.

    Save(String, SaveOptions)

    Saves the image to the specified file path.

    • C#
    • VB.NET
    public void Save(string path, SaveOptions options)
    Public Sub Save(path As String, options As SaveOptions)
    Parameters
    path
    System.String

    The file path in which to save the image.

    options
    SaveOptions

    The saving options which can be used to define settings for save operation.

    Exceptions
    System.ArgumentNullException

    path is null.

    Implements

    System.IDisposable
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.