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.

  • $\begingroup$ 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." $\endgroup$ – bill s Oct 20 '16 at 23:09
  • $\begingroup$ Import["https://s3.amazonaws.com/com.widelane.tmp/00048000.jpg"] does no harm for me. $\endgroup$ – corey979 Oct 20 '16 at 23:11
  • $\begingroup$ 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. $\endgroup$ – bill s Oct 20 '16 at 23:13
  • $\begingroup$ 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 $\endgroup$ – Bob Hanlon Oct 21 '16 at 0:02
  • $\begingroup$ 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.) $\endgroup$ – Szabolcs Oct 21 '16 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.

  • $\begingroup$ fantastic! I have thousands of these files to import. $\endgroup$ – Abel Brown Oct 21 '16 at 0:31

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

IncludeMetaInformation -> None]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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