"The image format is unrecognized" depending on monitor "The image format is unrecognized" depending on monitor wpf wpf

"The image format is unrecognized" depending on monitor


I had the same error today, out of the blue, and only on my development machine. The WPF implementation seems to be still buggy.

If I understand this (article) right, it can occur everywhere ICO files are read. In my case it was while setting an icon for the main application window in XAML:

<Window x:Class="MyApp.MainWindow"  Icon="Dashboard.ico" >

The above code failed suddenly, but using a PNG file solved the problem:

<Window x:Class="MyApp.MainWindow"  Icon="Dashboard.png" >


I've had a bit of fun with this problem this morning. It turned out that the error was occurring only on XP machines where the colour settings were set to 16 bit, and when I changed it to 32-bit the problem magically disappeared.

This goes for XP (including Embedded) SP3.


this issue has had me pulling my hair off for quite a long time, and I have spent quite a while trying to figure out what was going on so I'll share my conclusions since it might help someone else (possibly even myself in the future) :

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9e723d51-0e26-4609-8fe1-5e0edcf7385b/setting-windowicon-to-vista-256x256-png-icon-causes-a-fileformatexception?forum=wpf seems to indicate it'll resolve itself if you don't compress the icon. – Joachim Isaksson Jan 23 '12 at 12:44

so I looked up in icoFx (that I use for my icon editing) and sure enough :

options window in icoFx

I simply unchecked this and saved my .ico again (size went from 30Kb up to 286Kb in the process!) and voilà!

problem solved