我有一个应用程序依赖于深度缩放图像(从PNG转换为各种规模的JPG金字塔),我们使用DeepZoomTools.dll.这是依赖于PresentationCore.dll并且多年来一直运行良好.
在KB4040972和KB4040973的推出之后,从PNG到JPG的转换生成(取决于坐标)黑色图像而不是它应包含的图像.
如果以下代码在控制台或桌面应用程序中运行,则可以正常运行.
如果在高权限SYSTEM帐户下运行(例如,从任务计划程序),它只能起作用.
我创建了一个重现问题的项目,代码如下:
public static void TestConvert2(string strFileName, string strOutFileName) {
JpegBitmapEncoder jpegBitmapEncoder = new JpegBitmapEncoder();
jpegBitmapEncoder.QualityLevel = 1 + (int) Math.Round(0.95 * 99.0);
BitmapEncoder encoder = jpegBitmapEncoder;
Int32Rect inputRect = new Int32Rect(0, 0, 255, 255);
Rect outputRect = new Rect(0, 0, 255, 255);
Uri bitmapUri = new Uri(strFileName, UriKind.RelativeOrAbsolute);
BitmapDecoder bitmapDecoder = BitmapDecoder.Create(bitmapUri,
BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
bitmapDecoder = BitmapDecoder.Create(bitmapUri, BitmapCreateOptions.IgnoreImageCache, BitmapCacheOption.None);
BitmapSource inputFrame = (BitmapSource) bitmapDecoder.Frames[0];
BitmapSource source1 = (BitmapSource) new CroppedBitmap(inputFrame, inputRect);
DrawingVisual drawingVisual = new DrawingVisual(); …Run Code Online (Sandbox Code Playgroud)