Class VectorImage

Class VectorImage

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)

The vector image is the base class for all type of vector images.

[JsonObject(MemberSerialization.OptIn)]
public abstract class VectorImage : Image, IDisposable, IObjectWithBounds, IObjectWithSizeF

Inheritance

objectDisposableObjectDataStreamSupporterImageVectorImage

Derived

CdrImagePage, CmxImagePage, EpsImage, MetaImage, SvgImage, VectorMultipageImage

Implements

IDisposable, IObjectWithBounds, IObjectWithSizeF

Inherited Members

Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

The following example shows how to export a multipage vector image to another format in general way without referencing to a particular image type.```csharp [C#]

                                                                                                                                                          string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
                                                                                                                                                          string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
                                                                                                                                                          string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.tif");

                                                                                                                                                          Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                                                                          using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
                                                                                                                                                          {
                                                                                                                                                              exportOptions.MultiPageOptions = null;

                                                                                                                                                              // Export only first two pages
                                                                                                                                                              Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
                                                                                                                                                              if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
                                                                                                                                                              {
                                                                                                                                                                  exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
                                                                                                                                                              }

                                                                                                                                                              if (image is Aspose.Imaging.VectorImage)
                                                                                                                                                              {
                                                                                                                                                                  exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
                                                                                                                                                                  exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
                                                                                                                                                                  exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
                                                                                                                                                              }

                                                                                                                                                              image.Save(outputFilePath, exportOptions);
                                                                                                                                                          }

## Constructors

### <a id="Aspose_Imaging_VectorImage__ctor"></a> VectorImage\(\)

```csharp
protected VectorImage()

Properties

Height

Gets the image height.

public override int Height { get; }

Property Value

int

HeightF

Gets the object height, in inches.

public virtual float HeightF { get; }

Property Value

float

SizeF

Gets the object size, in inches.

public SizeF SizeF { get; }

Property Value

SizeF

Width

Gets the image width.

public override int Width { get; }

Property Value

int

WidthF

Gets the object width, in inches.

public virtual float WidthF { get; }

Property Value

float

Methods

Crop(Rectangle)

Crops the specified rectangle.

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

The rectangle.

GetEmbeddedImages()

Gets the embedded images.

public virtual EmbeddedImage[] GetEmbeddedImages()

Returns

EmbeddedImage[]

Array of images

Examples

Support extracting embedded raster images from a vector image```csharp [C#]

                                                                    var inputFileName = "test.cdr";
                                                                    using (var image = Aspose.Imaging.Image.Load(inputFileName))        
                                                                    {
                                                                        var vectorImage = ((Aspose.Imaging.VectorImage) image);
                                                                        var images = vectorImage.GetEmbeddedImages();
                                                                        var i = 0;
                                                                        foreach (var im in images)
                                                                        {
                                                                            var outFileName = string.Format("image{0}.png", i++);
                                                                            using (im)
                                                                            {
                                                                                im.Image.Save(outFileName, new PngOptions());
                                                                            }
                                                                        }
                                                                    }

### <a id="Aspose_Imaging_VectorImage_Modify_Aspose_Imaging_RectangleF_System_Single_System_Single_System_Single_"></a> Modify\(RectangleF, float, float, float\)

Resizes the specified rectangle.

```csharp
protected void Modify(RectangleF rectangle, float scaleX, float scaleY, float ratio)

Parameters

rectangle RectangleF

The rectangle.

scaleX float

The scale x.

scaleY float

The scale y.

ratio float

The ratio.

RemoveBackground()

Removes the background.

public virtual void RemoveBackground()

RemoveBackground(RemoveBackgroundSettings)

Removes the background.

public virtual void RemoveBackground(RemoveBackgroundSettings settings)

Parameters

settings RemoveBackgroundSettings

The settings.

Resize(int, int, ResizeType)

Resizes the specified new width.

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

The new width.

newHeight int

The new height.

resizeType ResizeType

Type of the resize.

Resize(int, int, ImageResizeSettings)

Resizes the image with extended options.

public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)

Parameters

newWidth int

The new width.

newHeight int

The new height.

settings ImageResizeSettings

The resize settings.

Rotate(float)

Rotate image around the center.

public override void Rotate(float angle)

Parameters

angle float

The rotate angle in degrees. Positive values will rotate clockwise.

RotateFlip(RotateFlipType)

Rotates, flips, or rotates and flips the image.

public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

Type of the rotate flip.

Exceptions

NotImplementedException

See Also

Image, IObjectWithSizeF