Interface IPicture
Represents the image in presentation.
Inherited Members
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.UWP.dll
Syntax
public interface IPicture : ISlideItem
Properties
Crop
Represents the crop properties used to define the portion of an image to be cropped.
Declaration
ICrop Crop { get; }
Property Value
Type |
---|
ICrop |
Examples
//Open an existing presentation.
IPresentation presentation = Presentation.Open("Input.pptx");
//Retrieve the first slide from the presentation.
ISlide slide = presentation.Slides[0];
//Retrieve the first picture from the slide.
IPicture picture = slide.Pictures[0];
//Crops the picture.
picture.Crop.ContainerLeft = 200;
picture.Crop.ContainerTop = 200;
picture.Crop.ContainerWidth = 200;
picture.Crop.ContainerHeight = 200;
//Save the presentation to the file system.
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open an existing presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Input.pptx")
'Retrieve the first slide from the presentation.
Dim slide As ISlide = presentation__1.Slides(0)
'Retrieve the first picture from the slide.
Dim picture As IPicture = slide.Pictures(0)
//Crops the picture.
picture.Crop.ContainerLeft = 200;
picture.Crop.ContainerTop = 200;
picture.Crop.ContainerWidth = 200;
picture.Crop.ContainerHeight = 200;
'Save the presentation to the file system.
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
ImageData
Gets or sets the image data as byte array.
Declaration
byte[] ImageData { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] | The byte data of the image. |
Examples
//Open an existing presentation.
IPresentation presentation = Presentation.Open("Picture.pptx");
//Retrieve the first slide from the presentation.
ISlide slide = presentation.Slides[0];
//Retrieve the first picture from the slide.
IPicture picture = slide.Pictures[0];
//Get the new picture as stream.
Stream pictureStream = File.Open("Image.gif", FileMode.Open);
//Create instance for memory stream
MemoryStream memoryStream = new MemoryStream();
//Copy stream to memoryStream.
pictureStream.CopyTo(memoryStream);
//Replace the existing image with new image.
picture.ImageData = memoryStream.ToArray();
//Save the presentation to the file system.
presentation.Save("ImageData.pptx");
//Close the presentation
presentation.Close();
'Open an existing presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Picture.pptx")
'Retrieve the first slide from the presentation.
Dim slide As ISlide = presentation__1.Slides(0)
'Retrieve the first picture from the slide.
Dim picture As IPicture = slide.Pictures(0)
'Get the new picture as stream.
Dim pictureStream As Stream = File.Open("Image.gif", FileMode.Open)
'Create instance for memory stream
Dim memoryStream As New MemoryStream()
'Copy stream to memoryStream.
pictureStream.CopyTo(memoryStream)
'Replace the existing image with new image.
picture.ImageData = memoryStream.ToArray()
'Save the presentation to the file system.
presentation__1.Save("ImageData.pptx")
'Close the presentation
presentation__1.Close()
ImageFormat
Gets the ImageFormat.
Declaration
ImageFormat ImageFormat { get; }
Property Value
Type | Description |
---|---|
ImageFormat | The image format of the current image. |
Examples
//Open an existing presentation.
IPresentation presentation = Presentation.Open("Picture.pptx");
//Retrieve the first slide from the presentation.
ISlide slide = presentation.Slides[0];
//Retrieve the first picture from the slide.
IPicture picture = slide.Pictures[0];
//Get the new picture as stream.
Stream pictureStream = File.Open("Image.gif", FileMode.Open);
//Create instance for memory stream
MemoryStream memoryStream = new MemoryStream();
//Copy stream to memoryStream.
pictureStream.CopyTo(memoryStream);
//Replace the existing image with new image.
picture.ImageData = memoryStream.ToArray();
//Get the image format of the pictures
Syncfusion.Drawing.ImageFormat imageFormat = picture.ImageFormat;
//Save the presentation to the file system.
presentation.Save("ImageData.pptx");
//Close the presentation
presentation.Close();
'Open an existing presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Picture.pptx")
'Retrieve the first slide from the presentation.
Dim slide As ISlide = presentation__1.Slides(0)
'Retrieve the first picture from the slide.
Dim picture As IPicture = slide.Pictures(0)
'Get the new picture as stream.
Dim pictureStream As Stream = File.Open("Image.gif", FileMode.Open)
'Create instance for memory stream
Dim memoryStream As New MemoryStream()
'Copy stream to memoryStream.
pictureStream.CopyTo(memoryStream)
'Replace the existing image with new image.
picture.ImageData = memoryStream.ToArray()
'Get the image format of the pictures
Dim imageFormat As Syncfusion.Drawing.ImageFormat = picture.ImageFormat
'Save the presentation to the file system.
presentation__1.Save("ImageData.pptx")
'Close the presentation
presentation__1.Close()
SvgData
Gets or sets the SVG image data as byte array. The default value is null.
Declaration
byte[] SvgData { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] | Returns the byte array of the SVG image. |
Examples
//Open an existing presentation.
IPresentation presDoc = Presentation.Open("Picture.pptx");
//Retrieve the first slide from the presentation.
ISlide slide = presDoc.Slides[0];
//Retrieve the first picture from the slide.
IPicture picture = slide.Pictures[0];
//Get the new SVG image as stream.
Stream svgStream = File.Open("Image.svg", FileMode.Open);
//Create instance for memory stream
MemoryStream memoryStream = new MemoryStream();
//Copy stream to memoryStream.
svgStream.CopyTo(memoryStream);
//Replace the existing svg image with new image.
picture.SvgData = memoryStream.ToArray();
//Save the presentation to the file system.
presDoc.Save("ImageData.pptx");
//Close the presentation
presDoc.Close();
'Open an existing presentation.
Dim presDoc As IPresentation = Presentation.Open("Picture.pptx")
'Retrieve the first slide from the presentation.
Dim slide As ISlide = presDoc.Slides(0)
'Retrieve the first picture from the slide.
Dim picture As IPicture = slide.Pictures(0)
'Get the new SVG image as stream.
Dim svgStream As Stream = File.Open("Image.svg", FileMode.Open)
'Create instance for memory stream
Dim memoryStream As New MemoryStream()
'Copy stream to memoryStream.
svgStream.CopyTo(memoryStream)
'Replace the existing svg image with new image.
picture.SvgData = memoryStream.ToArray()
'Save the presentation to the file system.
presDoc.Save("ImageData.pptx")
'Close the presentation
presDoc.Close()