ImageDataSave Method (String)

Saves the image into a file.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public void Save(
	string fileName
)

Parameters

fileName
Type: SystemString
The file name where to save the image.
Examples
Shows how to extract images from a document and save them as files.
public void ExtractImagesToFiles()
{
    Document doc = new Document(MyDir + "Images.docx");

    NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
    int imageIndex = 0;
    foreach (Shape shape in shapes.OfType<Shape>())
    {
        if (shape.HasImage)
        {
            string imageFileName =
                $"File.ExtractImagesToFiles.{imageIndex}{FileFormatUtil.ImageTypeToExtension(shape.ImageData.ImageType)}";
            shape.ImageData.Save(ArtifactsDir + imageFileName);
            imageIndex++;
        }
    }
}
See Also