日期:2014-05-19  浏览次数:20975 次

请高手帮忙改,数组转为图像
这段代码是将数组转为图像:
接收的body是一个数组,由,分隔开,需要转换,另外两个为宽度和高度。
----------------------
问题一:一直提示第6行出错(stirng[]   ac=ab.split( ', '),但是可以读出转换后的内容:错误是:未将对象引用设置到对象的实例
问题二:无法保存图片。高手帮忙看看,谢谢!  
 
  protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                string   ab   =   Request[ "body "];
                string   imw   =   Request[ "imgw "];
                string   imh=Request[ "imgh "];
                //string   SavePath   =   base.Server.MapPath( "UpLoadTemp/ ");
                //string[]   ac   =   new   string(
                String[]   ac   =   ab.Split( ', ');
                Int32   aw   =   Convert.ToInt32(imw);
                Int32   ah   =   Convert.ToInt32(imh);
                Bitmap   imgfll   =   new   Bitmap(aw,   ah);
                int   allrgb=0;
                for   (int   i   =   0;   i   <   ah;   i++)
                {
                        for   (int   j   =   0;   j   <   aw;   j++)
                        {
                                int   rgb   =   Convert.ToInt32(ac[allrgb]);
                                allrgb++;
                                imgfll.SetPixel(j,   i,Color.FromArgb(rgb));
                          }

                }
                //string   text2   =   DateTime.Now.ToString( "yyyyMMddhhmmss ")   +   ".jpg ";
                string   SavePath   =   base.Server.MapPath( "UpLoadTemp/ ")   +   "absc.jgp ";
                imgfll.Save(SavePath,   ImageFormat.Jpeg);
               
                Response.Write( "out= "   +   SavePath);
                imgfll.Dispose();
        }

------解决方案--------------------
ab是不是null?
string SavePath = base.Server.MapPath( "