I have a wpf app,and got a image useful for codebehind which\'s location in the project is something like \"projectName\\images\\pp.png\" and its build action is \"Resource\"(No
WPF - Get an Image Resource and Convert to System.Drawing.Image
var bitmapImage = new BitmapImage(new Uri(@"pack://application:,,,/"
+ Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ "images/pp.png", UriKind.Absolute));
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapImage)bitmapImage));
var stream = new MemoryStream();
encoder.Save(stream);
stream.Flush();
var image = new System.Drawing.Bitmap(stream);
Note:
Local Assembly Resource File
The pack URI for a resource file that is compiled into the local assembly uses the following authority and path:
pack://application:,,,/ReferencedAssembly;component/Subfolder/ResourceFile.Ext