"No imaging component suitable to complete this operation was found." "No imaging component suitable to complete this operation was found." wpf wpf

"No imaging component suitable to complete this operation was found."


.png files with a zero file size will give this identical error.


Your code works fine for me on a random image selected from Google images, so my guess is that the image you are downloading has an issue of some sort. You can try the following code in the handler right before Dispatcher.Invoke.

var encoder = new PngBitmapEncoder();var image = new BitmapImage( new Uri( "MyImage.png", UriKind.Relative ) );encoder.Frames.Add( BitmapFrame.Create( image ) );using ( var stream = new FileStream( "MyImage2.png", FileMode.Create, FileAccess.Write ) ){    encoder.Save( stream );}

Then use "MyImage2.png" instead. It is an attempt to have the encoder "fix" the image before loading it into the brush. To be honest, while this code works for me, I almost didn't post this because I have no idea if it will work for your situation, and I don't like posting code when I don't know the result. Definitely let me know if it helps.