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 6339101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:34:55+00:00 2026-05-24T19:34:55+00:00

How can I load an Image in WPF using the DotNetZip ZipEntry class. using

  • 0

How can I load an Image in WPF using the DotNetZip ZipEntry class.

using (ZipFile file = ZipFile.Read ("Images.zip"))
{
    ZipEntry entry = file["Image.png"];
    uiImage.Source = ??
}
  • 1 1 Answer
  • 0 Views
  • 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-24T19:34:56+00:00Added an answer on May 24, 2026 at 7:34 pm

    ZipEntry type exposes an OpenReader() method that returns a readable stream. This may work for you in this way:

    // I don't know how to initialize these things
    BitmapImage image = new BitmapImage(...?...);
    ZipEntry entry = file["Image.png"];
    image.StreamSource = entry.OpenReader(); 
    

    I am not certain this will work because:

    • I don’t know the BitmapImage class or how to manage it, or how to create one from a stream. I may have the code wrong there.

    • the ZipEntry.OpenReader() method internally sets and uses a file pointer that is managed by the ZipFile instance, and the readable stream is valid only for the lifetime of the ZipFile instance itself.
      The stream returned by ZipEntry.OpenReader() must be read before any subsequent calls to ZipEntry.OpenReader() for other entries, and before the ZipFile goes out of scope. If you need to extract and read multiple images from a zip file, in no particular order, or you need to read after you’re finished with the ZipFile, then you’ll need to work around that limitation. To do that, you could call OpenReader() and read all the bytes for each particular entry into a distinct MemoryStream.

    Something like this:

      using (ZipFile file = ZipFile.Read ("Images.zip"))        
      {        
          ZipEntry entry = file["Image.png"];
          uiImage.StreamSource = MemoryStreamForZipEntry(entry);        
      } 
    
     ....
    
    private Stream MemoryStreamForZipEntry(ZipEntry entry) 
    {
         var s = entry.OpenReader();
         var ms = new MemoryStream(entry.UncompressedSize);
         int n; 
         var buffer = new byte[1024];
         while ((n= s.Read(buffer,0,buffer.Length)) > 0) 
             ms.Write(buffer,0,n);
         ms.Seek(0, SeekOrigin.Begin);
         return ms;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need load image from assets I can read text file but i can
How can one load custom (not an image, nor a sound file) resource file
Hi i want to load png images and jpeg images. can anyone help me?
Hej I am trying to load an (embedded) image in a wpf application, using
How can I load an image in iphone webview from a .html file?
I need to load an image file to WPF's dynamic resource programmatically because the
I want to display images in WPF, but using an actual image, instead of
I don't know what's make wrong, my map can load, but the image on
I can't seem to figure out how to load a pictureBox image from a
I need to find/create a library that can load hdr images in many formats

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.