我正在使用以下代码截取我的应用程序的屏幕截图。然而,即使质量设置为 100,最终的屏幕截图仍然看起来很模糊。关于如何提高图像质量的任何建议。
public static void SaveJPGToLib(FrameworkElement element)
{
WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)element.ActualWidth, (int)element.ActualHeight);
bmpCurrentScreenImage.Render(element, new MatrixTransform());
bmpCurrentScreenImage.Invalidate();
using (var stream = new MemoryStream())
{
// Save the picture to the Windows Phone media library.
bmpCurrentScreenImage.SaveJpeg(stream, bmpCurrentScreenImage.PixelWidth, bmpCurrentScreenImage.PixelHeight, 0, 100);
stream.Seek(0, SeekOrigin.Begin);
string filename = "screenshots\\" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".jpg";
new MediaLibrary().SavePicture(filename, stream);
}
MessageBox.Show("Saved in your media library!", "Done", MessageBoxButton.OK);
}
请注意原始屏幕截图和生成的屏幕截图之间的差异。
原装品质
截屏