大图片使用多张小图和数组的形式组织,现在的问题是如何将其保存成整张JPG文件,请教各位大大

解决方案 »

  1.   


    //图像转换函数并返回Bitmap类型数据
            private Bitmap ConvertBitmapToScreen(string strBitmapPath, int iBitmapWidth, int iBitmapHeight)
            {
                //装载图片
                System.Drawing.Image image = System.Drawing.Image.FromFile(strBitmapPath);            //获取图片的实际宽度与高度
                int srcWidth = image.Width;
                int srcHeight = image.Height;            if (iBitmapHeight == 0 && iBitmapWidth == 0)
                {
                    return null;
                }            //创建Bitmap对象,并设置Bitmap的宽度和高度。
                Bitmap bmp = new Bitmap(iBitmapWidth, iBitmapHeight);            //从Bitmap创建一个System.Drawing.Graphics对象,用来绘制高质量的缩小图。
                System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
                //设置 System.Drawing.Graphics对象的SmoothingMode属性为HighQuality
                gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                //下面这个也设成高质量
                gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                //下面这个设成High
                gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
                //把原始图像绘制成上面所设置宽高的缩小图
                System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, iBitmapWidth, iBitmapHeight);
                gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel);            image.Dispose();            return bmp;
            }
    看看这个,或许对你有用
      

  2.   

    先谢各位大大, 
     System.Drawing.Image image = System.Drawing.Image.FromFile(strBitmapPath);

    Bitmap bmp = new Bitmap(iBitmapWidth, iBitmapHeight);
    会报内存不足,图片的分辨率太高了。
    有没有部分读入,而不是全图读入的方式进行转换,以减少内存的使用量?
      

  3.   

    gdi是没办法处理这么大的图片。包括vc,vb,dp
      

  4.   

    要想转换成jpg很复杂。自己也是搞了很久。