如何隐藏ASP.NET中的一个RGB通道?

时间:2012-06-05 20:21:50

标签: c# asp.net

我尝试过研究,但似乎ASP.NET中没有解决方案,只有webforms等。

例如,我可以为.jpg隐藏RGB通道(例如,仅限RED通道)吗?

1 个答案:

答案 0 :(得分:1)

using(var bmp = new Bitmap("C:\\temp\\source.jpg"))
{
    for (int x = 0; x < bmp.Width; x++)
    for (int y = 0; y < bmp.Height; y++)
    {
        var c = bmp.GetPixel(x, y);
        bmp.SetPixel(x, y, Color.FromArgb(c.A, 0, c.G, c.B));
    }
    bmp.Save("C:\\temp\\target.jpg", ImageFormat.Jpeg);
}
相关问题