Bad image quality when saving JPEG or PDF scans

Bug #2024887 reported by Geert Uytterhoeven
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
simple-scan (Ubuntu)
New
Undecided
Unassigned

Bug Description

Description: Ubuntu 22.04.2 LTS
Release: 22.04
simple-scan:
  Installed: 42.0-1
  Candidate: 42.0-1
  Version table:
 *** 42.0-1 500
        500 http://be.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

When saving a document scanned using "Image" settings to JPEG or PDF format, the resulting quality is really bad.
The image shown in the scan window looks fine, so this is not a scanner issue.
When saving to (lossless) PNG, the quality is also fine.

This is also reflected in the file sizes, e.g. for a 600 dpi scan of a 19x13 cm photo:
  - PNG: 12575069 bytes (OK)
  - JPEG: 227595 bytes (BAD)
  - PDF: 229414 bytes (BAD)
It looks like the compression rate for (embedded) JPEG files is way too large.

When scanning using "Text" settings, the resulting quality is fine (I rescanned an old document and compared the results). The difference with a scan using the "Image" settings is very clear, even for text documents.

Version 3.36.3-0ubuntu0.20.04.0 did not have this problem.
I downloaded and installed 42.5-1 from kinetic, but that did not fix the issue.

Thanks!

Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :

I debuild 44.0-0ubuntu1 from lunar, and that has the same issue.

> Version 3.36.3-0ubuntu0.20.04.0 did not have this problem.

That was when still running 20.04LTS.
When installing 3.36.3-0ubuntu0.20.04.0 (and its libwebp6_0.6.1-2ubuntu0.20.04.2_amd64.deb dependency) from focal on 22.04.2 LTS, the issue is present. So the regression is not in simple-scan itself, but must be in one of the libraries used by simple-scan.

This is a rather pressing issue for me, as I need this functionality for emailing signed contracts.
Thanks!

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report. Could you add a screenshot showing the issue?

Is there any message printed in the
$ journalctl -f
log when having the issue?

As a workaround you can use png and then use the image viewer to save back as jpg or print to pdf

Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :
Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :
Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :
Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :

"journalctl -f" does show some messages, but there is not really any difference depending on the selected file format.

Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :

I have just discovered a few good PDF image documents scanned with simple-scan 42.00 on January 22. So the regression was not introduced by the upgrade from 20.04LTS to 22.04LTS, but after that.
I will have a deeper look at the changes in /var/log/dpkg.log.* later...

Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :

TL;DR: Apparently the compression setting was set to the minimum value. Changing that fixed the problem.

---
Investigation log:
  1. Pointing LD_LIBRARY_PATH to a restored backup of /usr/lib/x86_64-linux-gnu does not help.
  2. "strace -f" shows no external programs are called to handle compression/saving.
  3. Looking at the simple-scan sources, there must be a quality setting somewhere in the GUI? But it's not in Preferences, where I believe there used to be such an option?
  4. Found it: when the file format at the bottom of the save dialog is set to JPEG or PDF, a small "Compression" slider is shown next to it, which I had never noticed before (I always change file format by editing the file name + extension at the top). This was set to its minimum value.
  5. Moving the slider to the right fixes the issue for me.

Revision history for this message
Geert Uytterhoeven (geert-linux-m68k) wrote :

Further investigation of my backups shows that I never had a "jpeg-quality" setting in GNOME settings on this machine before ("HOME=/path/to/restored/homedir dconf dump /org/gnome/simple-scan/").
I do have jpeg-quality=75 on the old machine that was connected to the scanner until 5 years ago...

So it looks like there is a problem with the default value if the "jpeg-quality" setting does not exist (i.e. has never been changed and saved?).

src/app-window.vala: quality_adjustment.value = settings.get_int ("jpeg-quality");

However, data/org.gnome.SimpleScan.gschema.xml does show a suitable default:

    <key name="jpeg-quality" type="i">
      <range min="0" max="100"/>
      <default>75</default>
      <summary>Quality value to use for JPEG compression</summary>
      <description>Quality value to use for JPEG compression.</description>
    </key>

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.