我的系统需要把以前的影像处理成要求的格式和大小,也就是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的话,会不会对图象质量造成影响?
float x = img.VerticalResolution;
float y = img.HorizontalResolution;
这样拿到的是x,y =96this.bmp.Save(filename); 存出来其实是200 dpi