如题   通过读取指定图片   进行处理后显示的图片变得模糊
有什么方法可以用吗。

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Drawing;
    using System.Drawing.Imaging;namespace WebTest
    {
        public partial class WebForm5 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Bitmap img = new Bitmap(@"E:\Temp\psu (1).jpg");
                SolidBrush pixelBrush;
                Graphics g = Graphics.FromImage(img);
                for (int i = 0; i < img.Width; i++)
                {
                
                    for (int j = 0; j < img.Height; j++)
                    {                    Color pixelColor = img.GetPixel(i-i%2, j-j%2);
           
                         pixelBrush = new SolidBrush(pixelColor);
                        g.FillRectangle(pixelBrush, i, j, 1, 1); 
                       
                    }
        
                   
                }
                Response.ContentType = "image/JPEG";
                img.Save(Response.OutputStream, ImageFormat.Jpeg);
                Response.End();
            }
        }
    }
    经过测试的,本来想用指针的形式,奈何没有调试成功,楼主可以 执行 提高效率