我为 SSRS 2012 尝试了一切,我的意思是一切。但最终我也放弃了。沿着汤姆的相同路线和大量谷歌搜索,我发现http://csharphelper.com/blog/2017/09/change-image-resolution-c/
这是工作模型:
public static string BumpUpResolution(string filename, float dpiX, float dpiY, string processID)
{
int oldWidth = 0, oldHeight = 0;
Bitmap image = new Bitmap(filename);
oldWidth = image.Width;
oldHeight = image.Height;
using (Bitmap bm = new Bitmap(oldWidth, oldHeight))
{
Point[] points = {
new Point(0,0),
new Point(oldWidth, 0),
new Point(0, oldHeight),
};
using (Graphics gr = Graphics.FromImage(bm))
{
gr.DrawImage(image, points);
}
bm.SetResolution(dpiX, dpiY);
bm.Save(Path.Combine(Path.GetDirectoryName(filename), string.Format("{0}{1}", processID, Path.GetExtension(filename))), System.Drawing.Imaging.ImageFormat.Tiff);
}
image.Dispose();
return Path.Combine(Path.GetDirectoryName(filename), string.Format("{0}{1}", processID, Path.GetExtension(filename)));
}