WebPImage Constructor (RasterImage)
Initializes a new instance of the WebPImage class from rasterImage.

Namespace: Aspose.Imaging.FileFormats.Webp
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
public WebPImage(
	RasterImage rasterImage


Type: Aspose.ImagingRasterImage
The raster image.
This example shows how to create a WebP image from another raster image.

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

// Load a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);

    // Fill the entire image in red.
    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
    graphics.FillRectangle(brush, pngImage.Bounds);

    // Create a WebP image based on the PNG image.
    using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(pngImage))
        // Save to a WebP file with default options
        webPImage.Save(dir + "output.webp", new Aspose.Imaging.ImageOptions.WebPOptions());
See Also