我的系统需要把以前的影像处理成要求的格式和大小,也就是A4 size, 200dpi ,用了程序:                     Bitmap bmpSource = new Bitmap(((Bitmap)this.images[0]), 1653, 2338);                    //Bitmap bmpSource = new Bitmap(((Bitmap)this.images[0]));                    int iSourceWidth = bmpSource.Width;                    int iSourceHeight = bmpSource.Height;                    float fSourceHorResolution = bmpSource.HorizontalResolution;                    float fSourceVerResolution = bmpSource.VerticalResolution;                    //图象dpi                    float fTargetHorResolution = 200;                    float fTargetVerResolution = 200;                    Bitmap bmpTarget = new Bitmap(1653, 2338);                    Graphics g = Graphics.FromImage(bmpTarget);                    g.DrawImage(bmpSource, 0, 0, iSourceWidth, iSourceHeight);                    bmpTarget.SetResolution(fTargetHorResolution, fTargetVerResolution);                    bmpTarget = TiffManager.ConvertTo1bbpIndexed(bmpTarget, (float)0.9);                    bmpTarget.Save(filename, info, ep); 在setResolution后,图象清晰度失真,变得很粗,我怀疑是原来图象96dpi,现在程序转成200dpi会造成像素填充. 一张黑白图上,只改动dpi的话,会不会对图象质量造成影响?

解决方案 »

  1.   

    什么意思?我是问改大dpi后清晰度会有失真吗?
      

  2.   

    当然会失真,这和用photoshop把一张320*240的图放大到640*480保存一个道理
      

  3.   

    那如何获得原始图象的dpi呢, 我现在读进来全变96了,说是windows的默认     System.Drawing.Image img = System.Drawing.Image.FromHbitmap(this.bmp.GetHbitmap());
                        float x = img.VerticalResolution;
                        float y = img.HorizontalResolution;
    这样拿到的是x,y =96this.bmp.Save(filename); 存出来其实是200 dpi