Image

Overview

Image is a class in Aspose.Note for Python. Inherits from: CompositeNode.

The Image class provides properties for FileName, Bytes, OriginalWidth, OriginalHeight, and Alignment, and methods to replace the image data or change its alignment.

Image represents an embedded image within a OneNote page. It exposes the raw image bytes via Bytes, the original filename via FileName, and the stored dimensions via OriginalWidth and OriginalHeight. Enumerate images with document.GetChildNodes(Image) to extract and save all embedded images from a document in a single pass.

Properties

NameTypeAccessDescription
FileNamestr | NoneReadGets or sets the image file name, if available
FilePathstr | NoneReadGets or sets the full path to the image file, if available
Formatstr | NoneReadGets or sets the image format identifier (e.g., “png”, “jpeg”)
BytesbytesReadReturns the raw binary data of the image
OriginalWidthfloat | NoneReadGets or sets the original width of the image in points
OriginalHeightfloat | NoneReadGets or sets the original height of the image in points
Tagslist[NoteTag]ReadReturns a list of NoteTag objects associated with the image
AlignmentHorizontalAlignment | NoneReadGets or sets the horizontal alignment of the image
Widthfloat | NoneReadThe rendered width of the image on the page canvas, or None
Heightfloat | NoneReadThe rendered height of the image on the page canvas, or None
HorizontalOffsetfloat | NoneReadThe horizontal position of the image on the page canvas, or None
VerticalOffsetfloat | NoneReadThe vertical position of the image on the page canvas, or None
IsBackgroundbool | NoneReadTrue if the image is a background image rather than inline content, or None
LastModifiedTimedatetime | NoneReadThe last-modified timestamp of the image element, or None
AlternativeTextTitlestr | NoneReadThe alternative text title for accessibility, or None
AlternativeTextDescriptionstr | NoneReadThe alternative text description for accessibility, or None
HyperlinkUrlstr | NoneReadThe URL of a hyperlink attached to this image, or None

Methods

SignatureDescription
__init__(FileName: str | None, FilePath: str | None, Format: str | None, Bytes: bytes, Width: float | None, Height: float | None, OriginalWidth: float | None, OriginalHeight: float | None, HorizontalOffset: float | None, VerticalOffset: float | None, Alignment: HorizontalAlignment | None, IsBackground: bool, LastModifiedTime: datetime | None, AlternativeTextTitle: str | None, AlternativeTextDescription: str | None, HyperlinkUrl: str | None, Tags: list[NoteTag] | None)
Replace(image: Image)Replaces the current image with the provided Image instance