Class Image
Inheritance
System.Object
Image
Assembly: IronPPT.dll
Syntax
public class Image : BaseGraphic, ICloneableElement, IImage, IGraphic, IContentElement
Placing a picture on a slide runs through Image, the graphic element that wraps a bitmap and carries it onto the presentation. Construct one from a file path, a stream, or an AnyBitmap, and the resulting object behaves like any other slide graphic that can be positioned, named, and cloned.
The constructors cover the common sources: new Image(string) loads from a path, new Image(Stream) reads from an open stream, and new Image(AnyBitmap) takes an already-loaded bitmap. A parameterless new Image() creates an empty graphic you fill later with LoadFromFile or LoadFromStream, and Replace swaps the picture for another IImage while keeping the element in place. The decoded picture is exposed through the get-only ImageData, an IImageContent.
Identity and appearance come from a small set of properties: Name and Id label the element, Type reports the ImageType, and FrameShape, a nullable ShapeType, crops the picture into a shape outline when set. Because Image derives from the shared graphic base and implements ICloneableElement, the Clone override returns a deep copy as an IContentElement, which is handy when the same picture appears on several slides. Position and sizing follow the same model as other graphics on the slide, so an Image is moved and scaled the way a shape is. When a picture is loaded once and reused, build it a single time and clone it per slide rather than reading the file again for each placement. To add and arrange a picture end to end, start from the image management workflow rather than wiring the pieces by hand.
using IronPPT.Models;
var image = new Image("logo.png");
image.Name = "BrandLogo";
slide.Shapes.AddShape(image);
The manage image how-to covers adding and editing images, the add image example places one on a slide, and the add shape example shows the surrounding shape model.
Constructors
Image()
Declaration
Image(AnyBitmap)
Declaration
public Image(AnyBitmap anyBitmap)
Parameters
| Type |
Name |
Description |
| IronSoftware.Drawing.AnyBitmap |
anyBitmap |
|
Image(Stream)
Declaration
public Image(Stream imageStream)
Parameters
| Type |
Name |
Description |
| System.IO.Stream |
imageStream |
|
Image(String)
Declaration
public Image(string imagePath)
Parameters
| Type |
Name |
Description |
| System.String |
imagePath |
|
Properties
FrameShape
Declaration
public Nullable<ShapeType> FrameShape { get; set; }
Property Value
Id
Declaration
public string Id { get; set; }
Property Value
| Type |
Description |
| System.String |
|
ImageData
Declaration
public IImageContent ImageData { get; }
Property Value
Name
Declaration
public string Name { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Type
Declaration
public ImageType Type { get; set; }
Property Value
Methods
Clone()
Declaration
public override IContentElement Clone()
Returns
Overrides
LoadFromFile(String)
Declaration
public void LoadFromFile(string imagePath)
Parameters
| Type |
Name |
Description |
| System.String |
imagePath |
|
LoadFromStream(Stream)
Declaration
public void LoadFromStream(Stream stream)
Parameters
| Type |
Name |
Description |
| System.IO.Stream |
stream |
|
Replace(IImage)
Declaration
public void Replace(IImage newImage)
Parameters
| Type |
Name |
Description |
| IImage |
newImage |
|
Implements