Grayscale

RasterImage.Grayscale method

将图像转换为其灰度表示

public virtual void Grayscale()

例子

以下示例将彩色光栅图像转换为其灰度表示。灰度图像仅由灰度阴影组成,仅携带强度信息。

[C#]

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

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

    rasterImage.Grayscale();
    rasterImage.Save(dir + "sample.Grayscale.png");
}

也可以看看