Image Class
The image is the base class for all type of images.
Inheritance Hierarchy

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 19.9
Syntax
public abstract class Image : DataStreamSupporter, 
	IObjectWithBounds

The Image type exposes the following members.

Constructors
  NameDescription
Protected methodImage
Initializes a new instance of the Image class.
Protected methodImage(IColorPalette)
Initializes a new instance of the Image class.
Properties
  NameDescription
Public propertyAutoAdjustPalette
Gets or sets a value indicating whether automatic adjust palette.
Public propertyBackgroundColor
Gets or sets a value for the background color.
Public propertyBitsPerPixel
Gets the image bits per pixel count.
Public propertyBounds
Gets the image bounds.
Public propertyBufferSizeHint
Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
Public propertyContainer
Gets the Image container.
Public propertyDataStreamContainer
Gets the object's data stream.
(Inherited from DataStreamSupporter.)
Public propertyDisposed
Gets a value indicating whether this instance is disposed.
(Inherited from DisposableObject.)
Public propertyFileFormat
Gets a value of file format
Public propertyHasBackgroundColor
Gets or sets a value indicating whether image has background color.
Public propertyHeight
Gets the image height.
Public propertyInterruptMonitor
Gets or sets the interrupt monitor.
Public propertyIsCached
Gets a value indicating whether object's data is cached currently and no data readig is required.
(Inherited from DataStreamSupporter.)
Public propertyPalette
Gets or sets the color palette.
Public propertyCode exampleSize
Gets the image size.
Public propertyWidth
Gets the image width.
Methods
  NameDescription
Public methodCode exampleCacheData
Caches the data and ensures no additional data loading will be performed from the underlying DataStreamContainer.
(Inherited from DataStreamSupporter.)
Public methodStatic memberCode exampleCanLoad(Stream)
Determines whether image can be loaded from the specified stream.
Public methodStatic memberCode exampleCanLoad(String)
Determines whether image can be loaded from the specified file path.
Public methodStatic memberCanLoad(Stream, LoadOptions)
Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.
Public methodStatic memberCanLoad(String, LoadOptions)
Determines whether image can be loaded from the specified file path and optionally using the specified open options.
Public methodCode exampleCanSave
Determines whether image can be saved to the specified file format represented by the passed save options.
Public methodStatic memberCode exampleCreate
Creates a new image using the specified create options.
Public methodCode exampleDispose
Disposes the current instance.
(Inherited from DisposableObject.)
Protected methodStatic memberDoAfterCreate
Does the after load.
Protected methodStatic memberDoAfterLoad
Does the after load.
Protected methodDoAfterSave
Does the after save.
(Inherited from DataStreamSupporter.)
Protected methodDoUseRecursion
Gets value indicating whether use recursion for synchronization.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize (Inherited from DisposableObject.)
Protected methodGetCanNotSaveMessage
Gets the can not save message.
Public methodGetDefaultOptions
Gets the default options.
Public methodStatic memberCode exampleGetFileFormat(Stream)
Gets the file format.
Public methodStatic memberCode exampleGetFileFormat(String)
Gets the file format.
Protected methodGetFitRectangle(Rectangle)
Gets rectangle which fits the current image.
Protected methodGetFitRectangle(Rectangle, Int32)
Gets rectangle which fits the current bitmap taking into account the pixels passed. The passed pixels array count should be equal to the fitting rectangle size.
Public methodStatic memberGetFittingRectangle(Rectangle, Int32, Int32)
Gets rectangle which fits the current image.
Public methodStatic memberGetFittingRectangle(Rectangle, Int32, Int32, Int32)
Gets rectangle which fits the current image.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Protected methodGetImage2Export
Gets the image to export.
Public methodGetOriginalOptions
Gets the options based on the original file settings. This can be helpful to keep bit-depth and other parameters of the original image unchanged. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the Save(String) method, the output PNG image with 8-bit per pixel will be produced. To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them to the Save(String, ImageOptionsBase) method as the second parameter.
Public methodStatic memberGetProportionalHeight
Gets a proportional height.
Public methodStatic memberGetProportionalWidth
Gets a proportional width.
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodStatic memberCode exampleLoad(Stream)
Loads a new image from the specified stream.
Public methodStatic memberCode exampleLoad(String)
Loads a new image from the specified file.
Public methodStatic memberLoad(Stream, LoadOptions)
Loads a new image from the specified stream.
Public methodStatic memberLoad(String, LoadOptions)
Loads a new image from the specified file.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnDataStreamContainerChanging
Called when data stream container is changing.
(Inherited from DataStreamSupporter.)
Protected methodOnPaletteChanged
Called when palette is changed.
Protected methodOnPaletteChanging
Called when palette is changing.
Protected methodReleaseManagedResources
Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.
(Overrides DataStreamSupporterReleaseManagedResources.)
Protected methodReleaseUnmanagedResources
Releases the unmanaged resources. Make sure no managed resources are released here, since they may have been already released.
(Inherited from DisposableObject.)
Public methodResize(Int32, Int32)
Resizes the image. The default LeftTopToLeftTop is used.
Public methodCode exampleResize(Int32, Int32, ImageResizeSettings)
Resizes the image.
Public methodCode exampleResize(Int32, Int32, ResizeType)
Resizes the image.
Public methodResizeHeightProportionally(Int32)
Resizes the height proportionally.
Public methodResizeHeightProportionally(Int32, ImageResizeSettings)
Resizes the height proportionally.
Public methodCode exampleResizeHeightProportionally(Int32, ResizeType)
Resizes the height proportionally.
Public methodResizeWidthProportionally(Int32)
Resizes the width proportionally.
Public methodResizeWidthProportionally(Int32, ImageResizeSettings)
Resizes the width proportionally.
Public methodCode exampleResizeWidthProportionally(Int32, ResizeType)
Resizes the width proportionally.
Public methodCode exampleRotateFlip
Rotates, flips, or rotates and flips the image.
Public methodCode exampleSave
Saves the image data to the underlying stream.
(Overrides DataStreamSupporterSave.)
Public methodSave(Stream)
Saves the object's data to the specified stream.
(Inherited from DataStreamSupporter.)
Public methodSave(String)
Saves the object's data to the specified file location.
(Inherited from DataStreamSupporter.)
Public methodSave(String, Boolean)
Saves the object's data to the specified file location.
(Inherited from DataStreamSupporter.)
Public methodCode exampleSave(Stream, ImageOptionsBase)
Saves the image's data to the specified stream in the specified file format according to save options.
Public methodCode exampleSave(String, ImageOptionsBase)
Saves the object's data to the specified file location in the specified file format according to save options.
Public methodCode exampleSave(Stream, ImageOptionsBase, Rectangle)
Saves the image's data to the specified stream in the specified file format according to save options.
Public methodCode exampleSave(String, ImageOptionsBase, Rectangle)
Saves the object's data to the specified file location in the specified file format according to save options.
Protected methodSaveData
Saves the data.
(Inherited from DataStreamSupporter.)
Public methodSetPalette
Sets the image palette.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Protected methodVerifyNotDisposed
Verifies that the current instance is not disposed.
(Inherited from DisposableObject.)
Fields
  NameDescription
Protected fieldTimeout
The timeout to wait for synchronization
(Inherited from DataStreamSupporter.)
Examples
This example creates a new Image file at some disk location as specified by Source property of the BmpOptions instance. Several properties for BmpOptions instance are set before creating the actual image. Especially the Source property, that refers to the actual disk location in this case.
[C#]

//Create an instance of BmpOptions and set its various properties
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;

//Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
//Second Boolean parameter determines if the file to be created IsTemporal or not
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\output.bmp", false);

//Create an instance of Image and initialize it with instance of BmpOptions by calling Create method
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
    //do some image processing

    // save all changes
    image.Save();
}
See Also
Inheritance Hierarchy