获取一张图片的字节数组及字节数组的合并

      public Byte[] Tupian() 获取一张图片的字节数组
        {
            FileStream fs = new FileStream(@"G:\smartrt\bin\Debug\Data\tpl\111.jpg", FileMode.Open);
            int filelength = 0;
            filelength=(int) fs.Length; //获得文件长度
            Byte[] fl = new Byte[filelength]; //建立一个字节数组
            fs.Read(fl, 0, filelength); //按字节流读取
            fs.Close();
            return fl;
        }
        public static byte[] copybyte(byte[] a, byte[] b)字节数组的合并
        {
            byte[] c = new byte[a.Length + b.Length];
            a.CopyTo(c, 0);
            b.CopyTo(c, a.Length);
            return c;
        }

posted on 2015-06-15 15:30  zrSoldier  阅读(711)  评论(0编辑  收藏  举报