Class Image

Class Image

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (24.12.0)

Represents an Image.

public sealed class Image : Node, IPageChildNode, IOutlineElementChildNode, ITaggable, INode

Inheritance

objectNodeImage

Implements

IPageChildNode, IOutlineElementChildNode, ITaggable, INode

Inherited Members

Node.Accept(DocumentVisitor), Node.Document, Node.IsComposite, Node.NodeType, Node.ParentNode, Node.PreviousSibling, Node.NextSibling, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Shows how to bind a hyperlink to an image.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 var document = new Document();

                                                 var page = new Page(document);

                                                 var image = new Image(document, dataDir + "image.jpg") { HyperlinkUrl = "http://image.com" };

                                                 page.AppendChildLast(image);

                                                 document.AppendChildLast(page);

                                                 document.Save(dataDir + "Image with Hyperlink_out.one");

Shows how to set text description for an image.```csharp
// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                          var document = new Document();
                                                          var page = new Page(document);
                                                          var image = new Image(document, dataDir + "image.jpg")
                                                                      {
                                                                          AlternativeTextTitle = "This is an image's title!",
                                                                          AlternativeTextDescription = "And this is an image's description!"
                                                                      };
                                                          page.AppendChildLast(image);
                                                          document.AppendChildLast(page);

                                                          dataDir = dataDir + "ImageAlternativeText_out.one";
                                                          document.Save(dataDir);

Shows how to get an image from a document.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> nodes = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in nodes)
                                                 {
                                                     using (MemoryStream stream = new MemoryStream(image.Bytes))
                                                     {
                                                         using (Bitmap bitMap = new Bitmap(stream))
                                                         {
                                                             // Save image bytes to a file
                                                             bitMap.Save(String.Format(dataDir + "{0}", Path.GetFileName(image.FileName)));
                                                         }
                                                     }
                                                 }</aspose.note.image></aspose.note.image>

Shows how to get image's meta information.```csharp
// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Images();

                                                     // Load the document into Aspose.Note.
                                                     Document oneFile = new Document(dataDir + "Aspose.one");

                                                     // Get all Image nodes
                                                     IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                     foreach (Aspose.Note.Image image in images)
                                                     {
                                                         Console.WriteLine("Width: {0}", image.Width);
                                                         Console.WriteLine("Height: {0}", image.Height);
                                                         Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                         Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                         Console.WriteLine("FileName: {0}", image.FileName);
                                                         Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                         Console.WriteLine();
                                                     }</aspose.note.image></aspose.note.image>

Shows how to add new image with tag.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                           // Create an object of the Document class
                                           Document doc = new Document();

                                           // Initialize Page class object
                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                           // Initialize Outline class object
                                           Outline outline = new Outline(doc);

                                           // Initialize OutlineElement class object
                                           OutlineElement outlineElem = new OutlineElement(doc);

                                           // Load an image
                                           Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "icon.jpg");

                                           // Insert image in the document node
                                           outlineElem.AppendChildLast(image);
                                           image.Tags.Add(NoteTag.CreateYellowStar());

                                           // Add outline element node
                                           outline.AppendChildLast(outlineElem);

                                           // Add outline node
                                           page.AppendChildLast(outline);

                                           // Add page node
                                           doc.AppendChildLast(page);

                                           // Save OneNote document
                                           dataDir = dataDir + "AddImageNodeWithTag_out.one";
                                           doc.Save(dataDir);

Shows how to add an image from file to a document with user defined properties.```csharp
// The path to the documents directory.
                                                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                                                          // Load document from the stream.
                                                                                          Document doc = new Document(dataDir + "Aspose.one");

                                                                                          // Get the first page of the document.
                                                                                          Aspose.Note.Page page = doc.FirstChild;

                                                                                          // Load an image from the file.
                                                                                          Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                    {
                                                                                                                        // Change the image's size according to your needs (optional).
                                                                                                                        Width = 100,
                                                                                                                        Height = 100,

                                                                                                                        // Set the image's location in the page (optional).
                                                                                                                        HorizontalOffset = 100,
                                                                                                                        VerticalOffset = 400,

                                                                                                                        // Set image alignment
                                                                                                                        Alignment = HorizontalAlignment.Right
                                                                                                                    };

                                                                                          // Add the image to the page.
                                                                                          page.AppendChildLast(image);

Shows how to add an image from stream to a document.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                           // Create an object of the Document class
                                                           Document doc = new Document();

                                                           // Initialize Page class object
                                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                           Outline outline1 = new Outline(doc);
                                                           OutlineElement outlineElem1 = new OutlineElement(doc);

                                                           using (FileStream fs = File.OpenRead(dataDir + "image.jpg"))
                                                           {

                                                               // Load the second image using the image name, extension and stream.
                                                               Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs)
                                                                                              {
                                                                                                  // Set image alignment
                                                                                                  Alignment = HorizontalAlignment.Right
                                                                                              };

                                                               outlineElem1.AppendChildLast(image1);
                                                           }

                                                           outline1.AppendChildLast(outlineElem1);
                                                           page.AppendChildLast(outline1);

                                                           doc.AppendChildLast(page);

                                                           // Save OneNote document
                                                           dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one";
                                                           doc.Save(dataDir);

Shows how to add an image from file to a document.```csharp
// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_Images();

                                                             // Create an object of the Document class
                                                             Document doc = new Document();

                                                             // Initialize Page class object
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Initialize Outline class object and set offset properties
                                                             Outline outline = new Outline(doc);

                                                             // Initialize OutlineElement class object
                                                             OutlineElement outlineElem = new OutlineElement(doc);

                                                             // Load an image by the file path.
                                                             Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                       {
                                                                                           // Set image alignment
                                                                                           Alignment = HorizontalAlignment.Right
                                                                                       };

                                                             // Add image
                                                             outlineElem.AppendChildLast(image);

                                                             // Add outline elements
                                                             outline.AppendChildLast(outlineElem);

                                                             // Add Outline node
                                                             page.AppendChildLast(outline);

                                                             // Add Page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document
                                                             dataDir = dataDir + "BuildDocAndInsertImage_out.one";
                                                             doc.Save(dataDir);

Constructors

Image(string)

Initializes a new instance of the Aspose.Note.Image class.

public Image(string path)

Parameters

path string

A string that contains the path to the file from which to create the Aspose.Note.Image.

Image(string, string, string)

Initializes a new instance of the Aspose.Note.Image class.

public Image(string path, string altTitle = null, string altDescription = null)

Parameters

path string

A string that contains the path to the file from which to create the Aspose.Note.Image.

altTitle string

The alternative title.

altDescription string

The alternative description.

Image(string, Stream)

Initializes a new instance of the Aspose.Note.Image class.

public Image(string fileName, Stream imageStream)

Parameters

fileName string

A name of the image.

imageStream Stream

A stream which contains the image.

Image()

Initializes a new instance of the Aspose.Note.Image class.

public Image()

Properties

Alignment

Gets or sets the alignment.

public HorizontalAlignment Alignment { get; set; }

Property Value

HorizontalAlignment

Examples

Shows how to add an image from file to a document with user defined properties.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                                                      // Load document from the stream.
                                                                                      Document doc = new Document(dataDir + "Aspose.one");

                                                                                      // Get the first page of the document.
                                                                                      Aspose.Note.Page page = doc.FirstChild;

                                                                                      // Load an image from the file.
                                                                                      Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                {
                                                                                                                    // Change the image's size according to your needs (optional).
                                                                                                                    Width = 100,
                                                                                                                    Height = 100,

                                                                                                                    // Set the image's location in the page (optional).
                                                                                                                    HorizontalOffset = 100,
                                                                                                                    VerticalOffset = 400,

                                                                                                                    // Set image alignment
                                                                                                                    Alignment = HorizontalAlignment.Right
                                                                                                                };

                                                                                      // Add the image to the page.
                                                                                      page.AppendChildLast(image);

Shows how to add an image from stream to a document.```csharp
// The path to the documents directory.
                                                               string dataDir = RunExamples.GetDataDir_Images();

                                                               // Create an object of the Document class
                                                               Document doc = new Document();

                                                               // Initialize Page class object
                                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                               Outline outline1 = new Outline(doc);
                                                               OutlineElement outlineElem1 = new OutlineElement(doc);

                                                               using (FileStream fs = File.OpenRead(dataDir + "image.jpg"))
                                                               {

                                                                   // Load the second image using the image name, extension and stream.
                                                                   Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs)
                                                                                                  {
                                                                                                      // Set image alignment
                                                                                                      Alignment = HorizontalAlignment.Right
                                                                                                  };

                                                                   outlineElem1.AppendChildLast(image1);
                                                               }

                                                               outline1.AppendChildLast(outlineElem1);
                                                               page.AppendChildLast(outline1);

                                                               doc.AppendChildLast(page);

                                                               // Save OneNote document
                                                               dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one";
                                                               doc.Save(dataDir);

Shows how to add an image from file to a document.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                         // Create an object of the Document class
                                                         Document doc = new Document();

                                                         // Initialize Page class object
                                                         Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                         // Initialize Outline class object and set offset properties
                                                         Outline outline = new Outline(doc);

                                                         // Initialize OutlineElement class object
                                                         OutlineElement outlineElem = new OutlineElement(doc);

                                                         // Load an image by the file path.
                                                         Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                   {
                                                                                       // Set image alignment
                                                                                       Alignment = HorizontalAlignment.Right
                                                                                   };

                                                         // Add image
                                                         outlineElem.AppendChildLast(image);

                                                         // Add outline elements
                                                         outline.AppendChildLast(outlineElem);

                                                         // Add Outline node
                                                         page.AppendChildLast(outline);

                                                         // Add Page node
                                                         doc.AppendChildLast(page);

                                                         // Save OneNote document
                                                         dataDir = dataDir + "BuildDocAndInsertImage_out.one";
                                                         doc.Save(dataDir);

### <a id="Aspose_Note_Image_AlternativeTextDescription"></a> AlternativeTextDescription

Gets or sets a body an alternative text for the image.

```csharp
public string AlternativeTextDescription { get; set; }

Property Value

string

Examples

Shows how to set text description for an image.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                      var document = new Document();
                                                      var page = new Page(document);
                                                      var image = new Image(document, dataDir + "image.jpg")
                                                                  {
                                                                      AlternativeTextTitle = "This is an image's title!",
                                                                      AlternativeTextDescription = "And this is an image's description!"
                                                                  };
                                                      page.AppendChildLast(image);
                                                      document.AppendChildLast(page);

                                                      dataDir = dataDir + "ImageAlternativeText_out.one";
                                                      document.Save(dataDir);

### <a id="Aspose_Note_Image_AlternativeTextTitle"></a> AlternativeTextTitle

Gets or sets a title of alternative text for the image.

```csharp
public string AlternativeTextTitle { get; set; }

Property Value

string

Examples

Shows how to set text description for an image.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                      var document = new Document();
                                                      var page = new Page(document);
                                                      var image = new Image(document, dataDir + "image.jpg")
                                                                  {
                                                                      AlternativeTextTitle = "This is an image's title!",
                                                                      AlternativeTextDescription = "And this is an image's description!"
                                                                  };
                                                      page.AppendChildLast(image);
                                                      document.AppendChildLast(page);

                                                      dataDir = dataDir + "ImageAlternativeText_out.one";
                                                      document.Save(dataDir);

### <a id="Aspose_Note_Image_Bytes"></a> Bytes

Gets the image data store.

```csharp
public byte[] Bytes { get; }

Property Value

byte[]

Examples

Shows how to get an image from a document.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> nodes = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in nodes)
                                                 {
                                                     using (MemoryStream stream = new MemoryStream(image.Bytes))
                                                     {
                                                         using (Bitmap bitMap = new Bitmap(stream))
                                                         {
                                                             // Save image bytes to a file
                                                             bitMap.Save(String.Format(dataDir + "{0}", Path.GetFileName(image.FileName)));
                                                         }
                                                     }
                                                 }</aspose.note.image></aspose.note.image>

### <a id="Aspose_Note_Image_FileName"></a> FileName

Gets the file name.

```csharp
public string FileName { get; }

Property Value

string

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

### <a id="Aspose_Note_Image_FilePath"></a> FilePath

Gets the path to the image file.

```csharp
public string FilePath { get; }

Property Value

string

Format

Gets the image’s format.

public ImageFormat Format { get; }

Property Value

ImageFormat

Height

Gets or sets the height. This is the real height of the image in the MS OneNote document.

public float Height { get; set; }

Property Value

float

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

Shows how to add an image from file to a document with user defined properties.```csharp
// The path to the documents directory.
                                                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                                                          // Load document from the stream.
                                                                                          Document doc = new Document(dataDir + "Aspose.one");

                                                                                          // Get the first page of the document.
                                                                                          Aspose.Note.Page page = doc.FirstChild;

                                                                                          // Load an image from the file.
                                                                                          Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                    {
                                                                                                                        // Change the image's size according to your needs (optional).
                                                                                                                        Width = 100,
                                                                                                                        Height = 100,

                                                                                                                        // Set the image's location in the page (optional).
                                                                                                                        HorizontalOffset = 100,
                                                                                                                        VerticalOffset = 400,

                                                                                                                        // Set image alignment
                                                                                                                        Alignment = HorizontalAlignment.Right
                                                                                                                    };

                                                                                          // Add the image to the page.
                                                                                          page.AppendChildLast(image);

HorizontalOffset

Gets or sets the horizontal offset.

public float HorizontalOffset { get; set; }

Property Value

float

Examples

Shows how to add an image from file to a document with user defined properties.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                                                      // Load document from the stream.
                                                                                      Document doc = new Document(dataDir + "Aspose.one");

                                                                                      // Get the first page of the document.
                                                                                      Aspose.Note.Page page = doc.FirstChild;

                                                                                      // Load an image from the file.
                                                                                      Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                {
                                                                                                                    // Change the image's size according to your needs (optional).
                                                                                                                    Width = 100,
                                                                                                                    Height = 100,

                                                                                                                    // Set the image's location in the page (optional).
                                                                                                                    HorizontalOffset = 100,
                                                                                                                    VerticalOffset = 400,

                                                                                                                    // Set image alignment
                                                                                                                    Alignment = HorizontalAlignment.Right
                                                                                                                };

                                                                                      // Add the image to the page.
                                                                                      page.AppendChildLast(image);

### <a id="Aspose_Note_Image_HyperlinkUrl"></a> HyperlinkUrl

Gets or sets the hyperlink associated with the image.

```csharp
public string HyperlinkUrl { get; set; }

Property Value

string

Examples

Shows how to bind a hyperlink to an image.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 var document = new Document();

                                                 var page = new Page(document);

                                                 var image = new Image(document, dataDir + "image.jpg") { HyperlinkUrl = "http://image.com" };

                                                 page.AppendChildLast(image);

                                                 document.AppendChildLast(page);

                                                 document.Save(dataDir + "Image with Hyperlink_out.one");

### <a id="Aspose_Note_Image_IsBackground"></a> IsBackground

Gets whether the image is a background image.

```csharp
public bool IsBackground { get; set; }

Property Value

bool

LastModifiedTime

Gets or sets last modified time.

public DateTime LastModifiedTime { get; set; }

Property Value

DateTime

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

### <a id="Aspose_Note_Image_OriginalHeight"></a> OriginalHeight

Gets the original height. This is the original width of the image, before resizing.

```csharp
public float OriginalHeight { get; }

Property Value

float

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

### <a id="Aspose_Note_Image_OriginalWidth"></a> OriginalWidth

Gets the original width. This is the original width of the image, before resizing.

```csharp
public float OriginalWidth { get; }

Property Value

float

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

### <a id="Aspose_Note_Image_Tags"></a> Tags

Gets the list of all tags of a paragraph.

```csharp
public List<itag> Tags { get; }

Property Value

List<ITag&gt;

Examples

Shows how to add new image with tag.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                           // Create an object of the Document class
                                           Document doc = new Document();

                                           // Initialize Page class object
                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                           // Initialize Outline class object
                                           Outline outline = new Outline(doc);

                                           // Initialize OutlineElement class object
                                           OutlineElement outlineElem = new OutlineElement(doc);

                                           // Load an image
                                           Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "icon.jpg");

                                           // Insert image in the document node
                                           outlineElem.AppendChildLast(image);
                                           image.Tags.Add(NoteTag.CreateYellowStar());

                                           // Add outline element node
                                           outline.AppendChildLast(outlineElem);

                                           // Add outline node
                                           page.AppendChildLast(outline);

                                           // Add page node
                                           doc.AppendChildLast(page);

                                           // Save OneNote document
                                           dataDir = dataDir + "AddImageNodeWithTag_out.one";
                                           doc.Save(dataDir);

### <a id="Aspose_Note_Image_VerticalOffset"></a> VerticalOffset

Gets or sets the vertical offset.

```csharp
public float VerticalOffset { get; set; }

Property Value

float

Examples

Shows how to add an image from file to a document with user defined properties.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                                                      // Load document from the stream.
                                                                                      Document doc = new Document(dataDir + "Aspose.one");

                                                                                      // Get the first page of the document.
                                                                                      Aspose.Note.Page page = doc.FirstChild;

                                                                                      // Load an image from the file.
                                                                                      Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                {
                                                                                                                    // Change the image's size according to your needs (optional).
                                                                                                                    Width = 100,
                                                                                                                    Height = 100,

                                                                                                                    // Set the image's location in the page (optional).
                                                                                                                    HorizontalOffset = 100,
                                                                                                                    VerticalOffset = 400,

                                                                                                                    // Set image alignment
                                                                                                                    Alignment = HorizontalAlignment.Right
                                                                                                                };

                                                                                      // Add the image to the page.
                                                                                      page.AppendChildLast(image);

### <a id="Aspose_Note_Image_Width"></a> Width

Gets or sets the width. This is the real width of the image in the MS OneNote document.

```csharp
public float Width { get; set; }

Property Value

float

Examples

Shows how to get image’s meta information.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images();

                                                 // Load the document into Aspose.Note.
                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                 // Get all Image nodes
                                                 IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                 foreach (Aspose.Note.Image image in images)
                                                 {
                                                     Console.WriteLine("Width: {0}", image.Width);
                                                     Console.WriteLine("Height: {0}", image.Height);
                                                     Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                     Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                     Console.WriteLine("FileName: {0}", image.FileName);
                                                     Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                     Console.WriteLine();
                                                 }</aspose.note.image></aspose.note.image>

Shows how to add an image from file to a document with user defined properties.```csharp
// The path to the documents directory.
                                                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                                                          // Load document from the stream.
                                                                                          Document doc = new Document(dataDir + "Aspose.one");

                                                                                          // Get the first page of the document.
                                                                                          Aspose.Note.Page page = doc.FirstChild;

                                                                                          // Load an image from the file.
                                                                                          Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                    {
                                                                                                                        // Change the image's size according to your needs (optional).
                                                                                                                        Width = 100,
                                                                                                                        Height = 100,

                                                                                                                        // Set the image's location in the page (optional).
                                                                                                                        HorizontalOffset = 100,
                                                                                                                        VerticalOffset = 400,

                                                                                                                        // Set image alignment
                                                                                                                        Alignment = HorizontalAlignment.Right
                                                                                                                    };

                                                                                          // Add the image to the page.
                                                                                          page.AppendChildLast(image);

Methods

Accept(DocumentVisitor)

Accepts the visitor of the node.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

The object of a class derived from the Aspose.Note.DocumentVisitor.

Replace(Image)

Replaces the current image data with the data from the provided Image object.

public void Replace(Image newImage)

Parameters

newImage Image

The Image object containing the new data.