Images import slowly in V11
Yes, the metadata import causes the performance regression in version 11.0. If you don't need Exif, IPTC and XMP metadata, then you can disable it using IncludeMetaInformation option:
In[1]:= $Version
Out[1]= "11.0.0 for Microsoft Windows (64-bit) (July 28, 2016)"
In[2]:= RepeatedTiming[images = Import["f:\\SampleImages\*"];]
Out[2]= {0.380, Null}
In[3]:= RepeatedTiming[ images = Import["f:\\SampleImages\*", IncludeMetaInformation -> None];]
Out[3]= {0.19, Null}
This is a long comment. I can reproduce the problem on OS X with version 11.0.0. I have not found a fix. I know that image import was changed in version 11 for all common formats and that a lot of metadata is now imported. This metadata is also stored in the Image
objects as the MetaInformation
option (can be retrieved with Options
). I don't know if the metadata import has anything to do with the performance regression (it may not be related at all).
Please contact Wolfram Support and let them know about this.
Here's a speed test on 40 JPEG images which I have in three different resolutions:
Version 11.0
dir = "full";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {2700, 1800} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {5.47223, Null} *)
dir = "medium";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {1620, 1080} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {3.31634, Null} *)
dir = "thumbnail"
(* "thumbnail" *)
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {640, 427} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {2.29118, Null} *)
Version 10.4.1
dir = "full";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {2700, 1800} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {5.13607, Null} *)
dir = "medium";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {1620, 1080} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {2.26651, Null} *)
dir = "thumbnail"
(* "thumbnail" *)
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {640, 427} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {1.15178, Null} *)
Version 9.0.1
Notice that the timing depends on the image size and for large images version 9 is slower than both version 10 and version 11.
dir = "full";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {2700, 1800} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {9.187798, Null} *)
dir = "medium";
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {1620, 1080} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {3.503787, Null} *)
dir = "thumbnail"
(* "thumbnail" *)
ImageDimensions@Import@First@FileNames[dir <> "/*.jpg"]
(* {640, 427} *)
Import[#, "Image"] & /@
FileNames[dir <> "/*.jpg"]; // AbsoluteTiming
(* {1.006552, Null} *)