.NET库在调整看起来很棒的图像方面表现非常出色:
Bitmap newImage = new Bitmap(newWidth, newHeight);
using (Graphics gr = Graphics.FromImage(newImage))
{
gr.InterpolationMode = InterpolationMode.HighQualityBilinear;
gr.DrawImage(srcImage, new Rectangle(0, 0, newWidth, newHeight));
}
我在网上看到的解决方案中遇到的一个问题是,它们会删除嵌入在这些图像中的元数据。有没有办法将这些数据传输到新图像?或者使用原始图像并保留这些数据?
理想情况下,如果可能,我还希望仅使用Microsoft内置的.NET库来保留此解决方案。