Message Boards Message Boards

2 Replies
4 Total Likes
View groups...
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\\100008.jpg"] ) with no success.  I can read the companion .CSV file, 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,
Import["", "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["","FileNames"];
img = Import["",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
or Discard

Group Abstract Group Abstract