Class Image
Contents
[
Hide
]Image class
The image is the base class for all type of images.
public abstract class Image : DataStreamSupporter, IObjectWithBounds
Properties
Name | Description |
---|---|
AutoAdjustPalette { get; set; } | Gets or sets a value indicating whether automatic adjust palette. |
virtual BackgroundColor { get; set; } | Gets or sets a value for the background color. |
abstract BitsPerPixel { get; } | Gets the image bits per pixel count. |
Bounds { get; } | Gets the image bounds. |
BufferSizeHint { get; set; } | Gets or sets the buffer size hint which is defined max allowed size for all internal buffers. |
Container { get; } | Gets the Image container. |
DataStreamContainer { get; } | Gets the object’s data stream. |
Disposed { get; } | Gets a value indicating whether this instance is disposed. |
virtual FileFormat { get; } | Gets a value of file format |
virtual HasBackgroundColor { get; set; } | Gets or sets a value indicating whether image has background color. |
abstract Height { get; } | Gets the image height. |
InterruptMonitor { get; set; } | Gets or sets the interrupt monitor. |
abstract IsCached { get; } | Gets a value indicating whether object’s data is cached currently and no data reading is required. |
Palette { get; set; } | Gets or sets the color palette. The color palette is not used when pixels are represented directly. |
Size { get; } | Gets the image size. |
virtual UsePalette { get; } | Gets a value indicating whether the image palette is used. |
abstract Width { get; } | Gets the image width. |
Methods
Name | Description |
---|---|
static Create(ImageOptionsBase, int, int) | Creates a new image using the specified create options. |
static Load(Stream) | Loads a new image from the specified stream. |
static Load(string) | Loads a new image from the specified file. |
static Load(Stream, LoadOptions) | Loads a new image from the specified stream. |
static Load(string, LoadOptions) | Loads a new image from the specified file. |
abstract CacheData() | Caches the data and ensures no additional data loading will be performed from the underlying DataStreamContainer . |
CanSave(ImageOptionsBase) | Determines whether image can be saved to the specified file format represented by the passed save options. |
Dispose() | Disposes the current instance. |
virtual GetDefaultOptions(object[]) | Gets the default options. |
virtual GetOriginalOptions() | 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 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 method as the second parameter. |
Resize(int, int) | Resizes the image. The default NearestNeighbourResample is used. |
abstract Resize(int, int, ImageResizeSettings) | Resizes the image. |
abstract Resize(int, int, ResizeType) | Resizes the image. |
ResizeHeightProportionally(int) | Resizes the height proportionally. |
virtual ResizeHeightProportionally(int, ImageResizeSettings) | Resizes the height proportionally. |
virtual ResizeHeightProportionally(int, ResizeType) | Resizes the height proportionally. |
ResizeWidthProportionally(int) | Resizes the width proportionally. The default NearestNeighbourResample is used. |
virtual ResizeWidthProportionally(int, ImageResizeSettings) | Resizes the width proportionally. |
virtual ResizeWidthProportionally(int, ResizeType) | Resizes the width proportionally. |
abstract RotateFlip(RotateFlipType) | Rotates, flips, or rotates and flips the image. |
Save() | Saves the image data to the underlying stream. |
virtual Save(Stream) | Saves the object’s data to the specified stream. |
Save(string) | Saves the object’s data to the specified file location. |
Save(Stream, ImageOptionsBase) | Saves the image’s data to the specified stream in the specified file format according to save options. |
virtual Save(string, bool) | Saves the object’s data to the specified file location. |
virtual Save(string, ImageOptionsBase) | Saves the object’s data to the specified file location in the specified file format according to save options. |
virtual Save(Stream, ImageOptionsBase, Rectangle) | Saves the image’s data to the specified stream in the specified file format according to save options. |
virtual Save(string, ImageOptionsBase, Rectangle) | Saves the object’s data to the specified file location in the specified file format according to save options. |
abstract SetPalette(IColorPalette, bool) | Sets the image palette. |
static CanLoad(Stream) | Determines whether image can be loaded from the specified stream. |
static CanLoad(string) | Determines whether image can be loaded from the specified file path. |
static CanLoad(Stream, LoadOptions) | Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions. |
static CanLoad(string, LoadOptions) | Determines whether image can be loaded from the specified file path and optionally using the specified open options. |
static GetFileFormat(Stream) | Gets the file format. |
static GetFileFormat(string) | Gets the file format. |
static GetFittingRectangle(Rectangle, int, int) | Gets rectangle which fits the current image. |
static GetFittingRectangle(Rectangle, int[], int, int) | Gets rectangle which fits the current image. |
static GetProportionalHeight(int, int, int) | Gets a proportional height. |
static GetProportionalWidth(int, int, int) | Gets a proportional width. |
Examples
This example creates a new Image file at some disk location as specified by Source property of the PsdOptions instance. Several properties for PsdOptions 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 PsdOptions and set its various properties
Aspose.PSD.ImageOptions.PsdOptions psdOptions = new Aspose.PSD.ImageOptions.PsdOptions();
//Create an instance of FileCreateSource and assign it as Source for the instance of PsdOptions
//Second Boolean parameter determines if the file to be created IsTemporal or not
psdOptions.Source = new Aspose.PSD.Sources.FileCreateSource(@"C:\temp\sample.psd", false);
//Create an instance of Image and initialize it with instance of PsdOptions by calling Create method
using (Aspose.PSD.Image image = Aspose.PSD.Image.Create(psdOptions, 500, 500))
{
//do some image processing
// save all changes
image.Save();
}
See Also
- class DataStreamSupporter
- interface IObjectWithBounds
- namespace Aspose.PSD
- assembly Aspose.PSD