Message Boards Message Boards

0
|
6753 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Is there a technique for importing JPG images from a folder in a zip file?

Posted 11 years ago
I have a file from Kaggle of jpg images all saved in a single folder in a zip file.  Importing the "Elements" of the zip file correctly identifies the "FileNames" as an element but asking for the "FileNames" gives an error: "Cannot import data as "ZIP" format."  I have tried a number of variations, including reading the files directly (as Import["images_training.zip","images_training\\100008.jpg"] ) with no success.  I can read the companion .CSV file, solutions_training.zip contents.

It this a limitation of Mathematica or a problem with the zip file or something that I have done incorrectly?
POSTED BY: Elton TeKolste
2 Replies
From the help center,  http://reference.wolfram.com/mathematica/ref/format/ZIP.html
Import["file.zip", "dir/*.jpg"] imports all JPEG files from subdirectory dir.
POSTED BY: Michael Rogers
Posted 11 years ago
Dear Elton,

Have you tried something like this?
fNames = Import["images_training.zip","FileNames"];
img = Import["images_training.zip",First@fnames]
(*Just doing the first file, but you can use any of the ones in the list *)
POSTED BY: Diego Zviovich
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract