当前位置: 代码迷 >> .NET报表 >> 存图片 怎么改变分辨率
  详细解决方案

存图片 怎么改变分辨率

热度:263   发布时间:2016-05-05 01:37:10.0
存图片 如何改变分辨率

Bitmap1.Save(ConfigurationManager.ConnectionStrings("imgPath").ToString + AearCode & ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

Bitmap1是自己画的

存完后分辨率是96*96 如何提高呢?
------解决思路----------------------
http://bbs.csdn.net/topics/110028928
------解决思路----------------------
如何设置图片的像素值
protected void Page_Load(object sender, EventArgs e)
    {
        //设置图像像素值
        try
        {
            int X =100, Y =100, Width = 80, Height = 80;
            Bitmap target = new Bitmap(Width, Height);
            Bitmap source = new Bitmap(Server.MapPath("test0.jpg"));
            for (int i = X; i < X + Width; i++)
            {
                for (int j = Y; j < Y + Height; j++)
                {
                    Color color = source.GetPixel(i, j);
                    target.SetPixel(i - X, j - Y, color);
                }
            }
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            target.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            Response.ClearContent();
            Response.ContentType = "image/Gif";
            Response.BinaryWrite(ms.ToArray());
        }
        catch{}
    }

------解决思路----------------------
不可能“提高”。

这样的图片,重新再保存它已经没有意义。你在显示时再去考虑改变尺寸就行了。
  相关解决方案