PngImage Constructor (String)
Initializes a new instance of the PngImage class.

Namespace: Aspose.Imaging.FileFormats.Png
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntax
public PngImage(
	string path
)

Parameters

path
Type: SystemString
The path to load an image.
Examples
This example shows how to load a PNG image from a file.
[C#]

string dir = "c:\\temp\\";

// Load a PNG image from a file.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png"))
{
    // Transform the image to grayscale representation
    pngImage.Grayscale();

    // Save to a file.
    pngImage.Save(dir + "sample.grayscale.png");
}
See Also