picPath = System.Windows.Forms.Application.StartupPath + "\\VideoPositionCheckTempDirectory";
Stream s = new FileStream(picPath + "\\vlcsnap-2012-01-06-18h26m51s7.png", FileMode.Open, FileAccess.Read, FileShare.Read);
Image img = new Bitmap(s);
Color curColor;
int ret;
{
for (int j = 0; j < img.Height; j++)
{
curColor = img.GetPixel(i, j);
ret = (int)(curColor.R * 0.299 + curColor.G * 0.587 + curColor.B * 0.114);
img.SetPixel(i, j, Color.FromArgb(ret, ret, ret));
}
}
{
img.SetPixel(i, 80, Color.FromArgb(255, 255, 255));
img.SetPixel(i, img.Height - 80, Color.FromArgb(255, 255, 255));
}
for (int j = 80; j < img.Height - 80; j++)
{
img.SetPixel(50, j, Color.FromArgb(255, 255, 255));
img.SetPixel(img.Width - 50, j, Color.FromArgb(255, 255, 255));
Stream s = new FileStream(picPath + "\\vlcsnap-2012-01-06-18h26m51s7.png", FileMode.Open, FileAccess.Read, FileShare.Read);
Image img = new Bitmap(s);
Color curColor;
int ret;
//图片变灰
for (int i = 0; i < img.Width; i++){
for (int j = 0; j < img.Height; j++)
{
curColor = img.GetPixel(i, j);
ret = (int)(curColor.R * 0.299 + curColor.G * 0.587 + curColor.B * 0.114);
img.SetPixel(i, j, Color.FromArgb(ret, ret, ret));
}
}
//画矩形
for (int i = 50; i < img.Width - 50; i++){
img.SetPixel(i, 80, Color.FromArgb(255, 255, 255));
img.SetPixel(i, img.Height - 80, Color.FromArgb(255, 255, 255));
}
for (int j = 80; j < img.Height - 80; j++)
{
img.SetPixel(50, j, Color.FromArgb(255, 255, 255));
img.SetPixel(img.Width - 50, j, Color.FromArgb(255, 255, 255));
}
s.Close();
s.Dispose();