ทั้ง ๆ ที่ path นี้ เอาไปใส่ในช่อง run ยังเจอภาพอยู่เลย
ช่วยด้วยนะครับ
Code (ASP)
System.Drawing.Bitmap image;
image = new System.Drawing.Bitmap(Server.MapPath("2.jpg"));
Color c;
for (int i = 0; i < image.Width; i++)
{
for (int j = 0; j < image.Height; j++)
{
c = image.GetPixel(i, j);
int r = 0;
r = Convert.ToInt16(c.R);
int g = 0;
g = Convert.ToInt16(c.G);
int b = 0;
b = Convert.ToInt16(c.B);
int ans = (r + g + b) / 3;
if (ans > 125)
{
r = 255;
g = 255;
b = 255;
}
else
{
r = 0;
g = 0;
b = 0;
}
c = Color.FromArgb(r, g, b);
image.SetPixel(i, j, c);
}
}
System.Drawing.Graphics G = System.Drawing.Graphics.FromImage(image);
//System.Drawing.Image bitmap2 = (System.Drawing.Image)Bitmap.FromFile(Server.MapPath("tham1.jpg"));
//G.DrawImage(bitmap2, (image.Width - bitmap2.Width) / 2, (image.Height - bitmap2.Height) / 2);
G.DrawImage(image, image.Width, image.Height);
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Jpeg);
String saveImagePath = Server.MapPath("ima\\2.jpg");
image.Save(saveImagePath);
TextBox1.Text = saveImagePath;
Image1.ImageUrl = saveImagePath;