# Import JPEG Fails

Bug introduced in 11.0.0 and persists through 11.0.1

I have a set of .jpg files that not only fail Import[] but also crash the kernel. Sample file here.

There is no diagnostic output from Import[], nothing. I just get the terminal "beep" and the kernel dies. The files open fine in Preview etc so I don't think they are corrupt.

Any advice would be much appreciated.

• It also crashes my kernel when I drag and drop it into a notebook, though I do get the (uninformative) message: "The kernel Local has quit (exited) during the course of an evaluation." Oct 20, 2016 at 23:09
• Import["https://s3.amazonaws.com/com.widelane.tmp/00048000.jpg"] does no harm for me. Oct 20, 2016 at 23:11
• As a work-around, you can load it into photoshop, save as a .png and then it imports OK. I'm guessing there is some kind of metadata that Mathematica isn't expecting and this gets stripped out when resaving. Oct 20, 2016 at 23:13
• On my Mac Import failed but Mathematica did not quit or crash. The following worked 1) On web site "Copy image", 2) open "Preview" and "File | New from Clipboard", 3) "Save..." to local file as JPEG, 4) Import local .jpg file Oct 21, 2016 at 0:02
• It's quite obviously a bug, so please do report it to Wolfram support. (I can confirm the crash with M11.0.1 on OS X.) Oct 21, 2016 at 0:21

This is clearly a bug, so please remember to report it to Wolfram.

You have many of these files so you need some workaround for an automated import. One way is to process the image through the jpegtran utility. It reads and writes from/to pipes, so something like this will work:

Import["!/opt/local/bin/jpegtran 00048000.jpg", "JPEG"]


I have jpegtran installed at the above location on OS X (through MacPorts), and I gave the full path. Use the correct location on your machine. Note the ! in the Import line: this tells Import to run the program and read its output instead of reading from a file.

• fantastic! I have thousands of these files to import. Oct 21, 2016 at 0:31

The bug is in reading Exif metadata. A workaround is to use IncludeMetaInformation -> None option:

Import["https://s3.amazonaws.com/com.widelane.tmp/00048000.jpg",
IncludeMetaInformation -> None]