ImageData
Overview
ImageData is a class in Aspose.Words FOSS for .NET.
Inherits from: IBorderAttrSource.
This class provides 9 methods for working with ImageData objects in .NET programs.
Available methods include: FitImageToShape, Save, SetImage, ToByteArray, ToImage, ToStream.
All public members are accessible to any .NET application after installing the Aspose.Words FOSS for .NET package.
Properties: BiLevel, Borders, Brightness, ChromaKey, Contrast, CropBottom, and 12 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
ImageBytes | byte[] | Read/Write | Gets or sets the image bytes. |
HasImage | bool | Read | Returns true if the shape has image bytes or links an image. |
ImageSize | ImageSize | Read | Gets the information about image size and resolution. |
ImageType | ImageType | Read | Gets the type of the image. |
IsLink | bool | Read | Returns true if the image is linked to the shape (when SourceFullName is specified). |
IsLinkOnly | bool | Read | Returns true if the image is linked and not stored in the document. |
SourceFullName | string | Read/Write | Gets or sets the path and name of the source file for the linked image. |
Title | string | Read/Write | Defines the title of an image. |
CropTop | double | Read/Write | Defines the fraction of picture removal from the top side. |
CropBottom | double | Read/Write | Defines the fraction of picture removal from the bottom side. |
CropLeft | double | Read/Write | Defines the fraction of picture removal from the left side. |
CropRight | double | Read/Write | Defines the fraction of picture removal from the right side. |
Borders | BorderCollection | Read | Gets the collection of borders of the image. |
ChromaKey | Color | Read/Write | Defines the color value of the image that will be treated as transparent. |
Brightness | double | Read/Write | Gets or sets the brightness of the picture. |
Contrast | double | Read/Write | Gets or sets the contrast for the specified picture. |
BiLevel | bool | Read/Write | Determines whether an image will be displayed in black and white. |
GrayScale | bool | Read/Write | Determines whether a picture will display in grayscale mode. |
Methods
| Signature | Description |
|---|---|
SetImage(image: Image) | Sets the image that the shape displays. |
SetImage(stream: Stream) | Sets the image value. |
SetImage(fileName: string) | Sets the image that the shape displays. |
ToImage() | Gets the image stored in the shape as a Imagejava BufferedImageImage object. |
ToStream() | Calls ToStream on this ImageData instance. |
ToByteArray() | Returns image bytes for any image regardless whether the image is stored or linked. |
Save(stream: Stream) | Calls Save(stream) on this ImageData instance. |
Save(fileName: string) | Saves the image into a file. |
FitImageToShape() | Fits the image data to Shape frame so that the aspect ratio of the image data matches the aspect ratio of Shape frame. |