2017-09-18 22 views
8

मेरे पास डीप ज़ूम छवियों (पीएनजी से विभिन्न पैमाने पर जेपीजी के पिरामिड में कनवर्टन) पर निर्भर अनुप्रयोग है, जिसे हम DeepZoomTools.dll का उपयोग करते हैं। यह PresentationCore.dll पर निर्भर है और वर्षों से ठीक काम कर रहा है।विंडोज अपडेट KB4040972/73 डब्ल्यूपीएफ कक्षाओं के साथ काले छवियों का कारण बनता है

KB4040972 और KB4040973 के रोलआउट के बाद, पीएनजी से जेपीजी में रूपांतरण (निर्देशांक के आधार पर) छवि के बजाय काले छवियों को उत्पन्न करना चाहिए।

यदि नीचे कोड एक कंसोल या डेस्कटॉप ऐप में चलाया जाता है, तो यह काम करता है।

यदि यह उच्च विशेषाधिकार प्रणाली खाते (जैसे कार्य शेड्यूलर से) के तहत चलाया जाता है तो यह केवल काम नहीं करता है।

मैं समस्या को ठीक करने प्रोजेक्ट बनाया हुआ है, नीचे दिए गए कोड:

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(); 
using(DrawingContext drawingContext = drawingVisual.RenderOpen()) { 
    drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)), null, outputRect); 
    drawingContext.DrawImage((ImageSource) source1, outputRect); 
    drawingContext.Close(); 
} 
RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(255, 255, 96.0, 96.0, PixelFormats.Default); 
renderTargetBitmap.Render((Visual) drawingVisual); 
source1 = (BitmapSource) new FormatConvertedBitmap((BitmapSource) renderTargetBitmap, PixelFormats.Bgr24, (BitmapPalette) null, 0.0); 
BitmapFrame frameToCache = BitmapFrame.Create(source1, (BitmapSource) null, null, (ReadOnlyCollection <ColorContext>) null); 
encoder.Frames.Add(frameToCache); 
using(FileStream fileStream = new FileStream(strOutFileName, FileMode.Create)) { 
    encoder.Save((Stream) fileStream); 
    fileStream.Flush(); 
} 
} 

वहाँ कोई सुराग?

+0

शायद यह SO के लिए एक अच्छा सवाल नहीं है, यह बस विंडोज़ में एक बग है, – zowers

+0

https://social.msdn.microsoft.com/Forums/vstudio/en-US/0f14f14c-5cd3-4505-9168-2ef9dc1f7031 देखें/kb-4041083-kb-4040973-has-broken-wpf-rendering-in-services? forum = wpf – zowers

+0

यहां एक ही समस्या है। –

उत्तर

2

माइक्रोसॉफ्ट ने एक लेख प्रकाशित किया है जहां वे कहते हैं कि वे इस समस्या से अवगत हैं और एक संकल्प पर काम कर रहे हैं। वे 12 सितंबर, 2017, सुरक्षा और गुणवत्ता रोलअप अपडेट को अस्थायी रूप से हटाने के लिए मूल रूप से एक वर्कअराउंड भी प्रदान करते हैं।

देखें: https://support.microsoft.com/en-us/help/4043601/rendering-issues-after-the-september-12-2017-net-security-and-quality

+0

समाधान ".NET Framework अक्टूबर 2017 सुरक्षा और गुणवत्ता रोलअप" अद्यतन के साथ उपलब्ध है। देखें: https://blogs.msdn.microsoft.com/dotnet/2017/10/10/net-framework-october-2017-security-and-quality-rollup/ –

0
अंत माइक्रोसॉफ्ट KB4043767 से सिफारिश की अद्यतन इस मुद्दे का हल में

हमारे लिए। यह अक्टूबर रोलआउट (वर्तमान में पूर्वावलोकन में) का हिस्सा होगा।

संबंधित मुद्दे