0
$\begingroup$

Suppose I have

images = {{1.jpg, 2.jpg}, {3.jpg, 4.jpg}}

Now I try to import all of them at level 2,

Map[Import[#], image, {2}]

Why does Mathematica say there is an invalid file? (error Import::chtype)

$\endgroup$
3
  • 1
    $\begingroup$ Map[Import[#]&,image,{2}] for starters... $\endgroup$
    – ciao
    Mar 5, 2015 at 11:04
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Mar 5, 2015 at 11:11
  • 2
    $\begingroup$ you have image one place and images the other. filenames need to be quoted $\endgroup$
    – george2079
    Mar 5, 2015 at 11:27

1 Answer 1

1
$\begingroup$

Try something like:

imageFileNameList = {"1.jpg", "2.jpg"};
imageList = (Import[#]&) /@ imageFileNameList

In the format you used, the Import function was expecting a string and found a list. Be sure to include the path to the files as well.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.