Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Eye of GNOME does not load JPG

📅 2015-Oct-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ eye of gnome, jpg, nautilus, nemo, png ⬩ 📚 Archive

Problem

I tried to open a JPG image file using Eye of GNOME. It failed with this error:

Could not load image 'foo.jpg'
Error interpreting JPEG image file (Not a JPEG file: starts with 0x89 0x50)

When I opened the same file using another image viewer, it opened without any problem!

Another symptom of this problem is that the thumbnail of the image file is not displayed in Nautilus or in Nemo file explorers. All of these programs use the same backend for image display.

Solution

This problem is typically caused when the image is actually a PNG file. Some apps on Android are notorious for saving all image formats as JPG.

As noted by EOG, the file starts with the magic identifier 0x89 0x50, which is for PNG format. You can also check the same by using the file command:

$ file foo.jpg
foo.jpg: PNG image data, 716 x 960, 8-bit/color RGB, non-interlaced

We can see that file reports this JPG file as containing PNG image data.

Just rename the JPG file with the correct .png file extension and EOG will open it correctly. You will also see that thumbnails are now rendered correctly.

Admittedly, EOG could have detected the format correctly and shown a more informative error message. I have seen other image viewers do that. This has been filed as a bug here.

Tried with: Eye of GNOME 3.10.2 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧