Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 662573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:23:36+00:00 2026-05-13T23:23:36+00:00

I have a folder in my WPF app Images that has several .png files

  • 0

I have a folder in my WPF app “Images” that has several .png files with their Build Action set to Resource. These are built into my binary since I can reference them in XAML.

I would like to write these to disk in the temp folder. How do I do this?

I have found several answers referring to Embedded Resources, but not just plain resources.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:23:37+00:00Added an answer on May 13, 2026 at 11:23 pm

    Answer!

     public static void ExtractFileFromResources(String filename, String location)
      {
    
         StreamResourceInfo sri =  System.Windows.Application.GetResourceStream(
          new Uri("pack://application:,,,/Images/" + filename));
    
         Stream resFilestream = sri.Stream;
    
         if (resFilestream != null)
         {
            BinaryReader br = new BinaryReader(resFilestream);
            FileStream fs = new FileStream(location, FileMode.Create);
            BinaryWriter bw = new BinaryWriter(fs);
            byte[] ba = new byte[resFilestream.Length];
            resFilestream.Read(ba, 0, ba.Length);
            bw.Write(ba);
            br.Close();
            bw.Close();
            resFilestream.Close();
         }
    
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have several WPF projects that need to access a folder of images.
I have simple WPF app that I deployed using click once to shared folder
I have a wpf application that has a button for for each folder under
I have a WPF ListBox that displays images loaded from a local folder, usually
I have a WPF app with image resources. When I build the program, there
I have a WPF app that works beautifully if I debug (F5) in Visual
I am totally new to WPF, I have created a simple WPF app that
I Have several images set as Resources in my project. now i want to
I have wpf prism application with some modules. One module has folder sounds and
I have a WPF project. If I store image in {ProjectRoot}\Images\image.png, and compile it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.