当前位置: 代码迷 >> ASP.NET >> 怎么经过后台处理 让清晰的图片变得模糊
  详细解决方案

怎么经过后台处理 让清晰的图片变得模糊

热度:2655   发布时间:2013-02-25 00:00:00.0
如何经过后台处理 让清晰的图片变得模糊
如题 通过读取指定图片 进行处理后显示的图片变得模糊
有什么方法可以用吗。

------解决方案--------------------------------------------------------
C# code
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();        }    }}
------解决方案--------------------------------------------------------
所有圖像控件都有這小兒科功能
  相关解决方案