Access Images in a zip file without unzipping

13 views (last 30 days)
Tobias Kiessling
Tobias Kiessling on 27 Apr 2011
Hi all,
I'd like to read some png-images within a zip file on my harddisk. Since I have thousands of images within hundreds of zip files, it would be extremely nice to read the image files without the need for unzipping the requested files to my harddrive). I've opened matlab's unzip.m file and realized, that it is partially written in java. I'm not very experienced with Java, but maybe some of you know a handy solution for my problem (a special java class, or a method for this 'org.apache.tools.zip.ZipFile' class unzip.m is using)
thanks, tobi

Answers (1)

Jarrod Rivituso
Jarrod Rivituso on 27 Apr 2011
You may be able to find an external unzip utility and call it from within MATLAB using the system function. The GNU unzip seems to support the behavior you are looking for:
If you aren't very experienced with Java, I wouldn't recommend going the Java route, though I'm sure this could be done using something like what is described here:
So, I'd recommend you
  1. Find and install a utility that gives you the required functionality, such as the GNU unzip. Make sure it is on your system path when you start MATLAB.
  2. Call the utility from within MATLAB using the system function
system('unzip allPics.zip pic314.png');
Hope this helps!
  1 Comment
Tobias Kiessling
Tobias Kiessling on 28 Apr 2011
Ok, this is a solution, however, I still have to extract parts of the zip-file to the harddrive, and then again load it into memory for reading the image data into matlab. That's what I actually was trying to avoid. Nevertheless, thank you very much for your answer

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!