📄 createimg.aspx.cs
字号:
using System;
using System.Drawing;
using System.Drawing.Imaging;
public partial class createimg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void Oldimg(string spath, string npath)
{
Bitmap currentBitmap = new Bitmap(spath);
Graphics g = Graphics.FromImage(currentBitmap);
#region 调整颜色矩阵
ImageAttributes ia = new ImageAttributes();
//黑白
float[][] colorMatrix = {
new float[] {0.3F, 0.3F, 0.3F, 0, 0},
new float[] {0.59F, 0.59F, 0.59F, 0, 0},
new float[] {0.11F, 0.11F, 0.11F, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0, 0, 0, 0, 1}};
ColorMatrix cm = new ColorMatrix(colorMatrix);
ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
g.DrawImage(currentBitmap, new Rectangle(0, 0, currentBitmap.Width, currentBitmap.Height), 0, 0, currentBitmap.Width, currentBitmap.Height, GraphicsUnit.Pixel, ia);
#endregion 调整颜色矩阵
//浮雕
//currentBitmap = GetImageLine(currentBitmap);
currentBitmap.Save(npath, ImageFormat.Jpeg);
g.Dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -