图象高手来救急:关于只修改图象dpi,不改变图象的方法
这个是用位图去修改图象的dpi ,速度慢而且修改完后图象暴增
Bitmap bmpSource = new Bitmap(fileName);
int iSourceWidth = bmpSource.Width;
int iSourceHeight = bmpSource.Height;
float fSourceHorResolution = bmpSource.HorizontalResolution;
float fSourceVerResolution = bmpSource.VerticalResolution;
//图象dpi
float fTargetHorResolution = 300;
float fTargetVerResolution = 300;
Bitmap bmpTarget = new Bitmap(iSourceWidth, iSourceHeight);
Graphics g = Graphics.FromImage(bmpTarget);
g.DrawImage(bmpSource, 0, 0, iSourceWidth, iSourceHeight);
bmpTarget.SetResolution(fTargetHorResolution, fTargetVerResolution);
bmpTarget.Save(fileName);
想请教有没有更简便点的方法,直接去修改图象属性中的dpi的值