JPG photo not viewable via default image viewer, but opens fine via Firefox

Bug #1747558 reported by Ken T
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gpicview (Ubuntu)
New
Undecided
Unassigned
libjpeg-turbo (Ubuntu)
New
Undecided
Unassigned
mtpaint (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Using Lubuntu i386 daily build downloaded approx 36hours ago.

In documenting a separate bug, I took a photo via the inbuilt camera in my Nokia dumbphone. Low-res, small image size. Transferred from phone & saved to desktop.

Opening that JPG in Image Viewer brings up the error message "Error interpreting JPEG image file (Application transferred too few scanlines)", yet the image is perfectly viewable in Firefox.

Have attached the JPG in question to this bug report - the contents of this photo are also relevant to Bug 1747341.

Thanks,
Ken.
***

Tags: bionic xenial
Revision history for this message
Ken T (professorsnapper) wrote :
Revision history for this message
Ken T (professorsnapper) wrote :

It seems this bug affects more than one program in the Lubuntu daily build (same build as initial bug reported from). When I try and open the same JPG image file (attached to this bug report) in mtPaint 3.40, an error message simply says 'cannot open file'.

Yet, that same image opens just fine under Gnome Image Viewer 3.26.2 (the default image viewer under the Ubuntu daily build / dev branch for 18.04), and as previously reported it opens fine via Firefox.

Thanks,
Ken.
***

Simon Quigley (tsimonq2)
no longer affects: lubuntu-next
Ken T (professorsnapper)
tags: added: bionic
Revision history for this message
Ken T (professorsnapper) wrote :

As of Lubuntu 18.04 32bit beta 2, the attached image file now opens fine in mtpaint, but still refuses to open in Lubuntu's default image viewer, with the same error message as above.

Thanks,
Ken.
***

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mtpaint (Ubuntu):
status: New → Confirmed
Revision history for this message
sudodus (nio-wiklund) wrote :

This bug affects my Lubuntu 16.04 LTS (32-bit) and its default gpicview. But it also affects ristretto (with the same complaint)

"Error interpreting JPEG image file (Application transferred too few scanlines)"

So this is not a Lubuntu problem. I would suspect that some library package, that is used by both Lubuntu and Xubuntu (16.04 LTS) cannot handle the file, and I suspect that the file does not comply to the JPEG standard.

tags: added: xenial
Revision history for this message
Ken T (professorsnapper) wrote :

Interesting idea. Any ideas on how we might isolate / identify the library in question to test further?

Revision history for this message
sudodus (nio-wiklund) wrote :

This bug also affects Lubuntu Bionic amd64 (64-bit), soon released as Lubuntu 18.04 LTS.

no longer affects: lubuntu-next
Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

Lubuntu 16.04 LTS 64 bit up-to-date

I have this problem opening JPG files with the default viewer, gpicview. The message is:

Error interpreting JPEG image file (Application transferred too few scanlines)

All other viewers (firefox, imagemagick, mtpaint, libreoffice impress work fine.

gimp shows this warning:

Premature end of JPEG file

Not all my JPG files are affected. Some of them doesn't have the problem.

Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

I tried many viewers. Some of them worked. I configured eog (Eye of Gnome) as my default viewer as work-around.

I found also another work-around with convert command (from imagemagick):

convert wrong.jpg correct.jpg

But I prefer not to modify my JPG files. I found a documentation about libjpeg where it appears this error explained:

https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf

I think the applications have to manage this warning, and some viewers/editors do and others not.

Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

The string "Premature end of JPEG file" showed by gimp and imagemagick utilities (identify, convert) is present on libjpeg8 code (taken from http://ijg.org/files/)

user@lubuntu:~/Downloads/jpeg-8d$ grep Premature *
cderror.h:JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
cderror.h:JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
jerror.h:JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
jerror.h:JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
rdjpgcom.c: ERREXIT("Premature EOF in JPEG file");
rdjpgcom.c: ERREXIT("Premature EOF in JPEG file");
rdjpgcom.c: ERREXIT("Premature EOF in JPEG file");
wrjpgcom.c: ERREXIT("Premature EOF in JPEG file");
wrjpgcom.c: ERREXIT("Premature EOF in JPEG file");
wrjpgcom.c: ERREXIT("Premature EOF in JPEG file");

Most of viewers/editors use libjpeg8:

user@lubuntu:~$ apt-cache depends libmagickcore-6.q16-2 | grep libjpeg
  Depends: libjpeg8
user@lubuntu:~$ apt-cache depends eog | grep libjpeg
  Depends: libjpeg8
user@lubuntu:~$ apt-cache depends gpicview | grep libjpeg
  Depends: libjpeg8
user@lubuntu:~$ apt-cache depends gimp | grep libjpeg
  Depends: libjpeg8
user@lubuntu:~$ apt-cache depends mtpaint | grep libjpeg
  Depends: libjpeg8
user@lubuntu:~$ apt-cache depends libreoffice-core | grep libjpeg
  Depends: libjpeg8

But browsers don't use it:

user@lubuntu:~$ apt-cache depends firefox | grep libjpeg
user@lubuntu:~$ apt-cache depends chromium-browser | grep libjpeg
user@lubuntu:~$ apt-cache depends google-chrome-stable | grep libjpeg

So, my conclusion it's that the error appears as a warning when using libjpeg8 and the viewer/editor should manage it.

Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

I'm sorry! Browsers use also libjpeg8 because they use libgdk-pixbuf2.0-0 and ...

user@lubuntu:~$ apt-cache depends libgdk-pixbuf2.0-0 | grep libjpeg
  Depends: libjpeg8

Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

I found that, in fact, libjpeg8 is only a dependency package for libjpeg-turbo8.

user@lubuntu:~$ dpkg -l | grep libjpeg
ii libjpeg-turbo8:amd64 1.4.2-0ubuntu3.1 amd64 IJG JPEG compliant runtime library.
ii libjpeg-turbo8:i386 1.4.2-0ubuntu3.1 i386 IJG JPEG compliant runtime library.
ii libjpeg8:amd64 8c-2ubuntu8 amd64 Independent JPEG Group's JPEG runtime library (dependency package)
ii libjpeg8:i386 8c-2ubuntu8 i386 Independent JPEG Group's JPEG runtime library (dependency package)

So, the systems are using libjpeg-turbo8. The string "Premature end of JPEG file" exists also in libjpeg-turbo8 code:

https://github.com/libjpeg-turbo/libjpeg-turbo/search?q=Premature+end+of+JPEG+file&unscoped_q=Premature+end+of+JPEG+file

no longer affects: libjpeg8 (Ubuntu)
Revision history for this message
Josep Pujadas-Jubany (jpujades) wrote :

I tested some more JPG images from two different Android smartphones and I experiencing the same problem. These smartphones were upgraded some weeks ago and I think the problem is related to its Android version. Old JPG images are ok, but newer not.

Searching at the internet I found some users with similar trouble:

https://forums.androidcentral.com/moto-g-2015/694693-moto-g-2015-corrupted-photos-thumbnail-ok-but-can-opened-computer.html

https://developer.samsung.com/forum/thread/s7-saving-invalid-jpeg-format-for-panoramas/201/303807?boardName=SDK&startId=zzzzz~&searchSubId=0000000045

https://github.com/libjpeg-turbo/libjpeg-turbo/issues/163

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.