Bug 431782 - Incorrect resolution detected for HP Scanjet 3400C
Summary: Incorrect resolution detected for HP Scanjet 3400C
Status: CONFIRMED
Alias: None
Product: Skanlite
Classification: Applications
Component: general (show other bugs)
Version: 2.2.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Kåre Särs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-18 14:16 UTC by Ilario Gottardello
Modified: 2021-02-11 09:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Size in cm (52.88 KB, image/png)
2021-02-10 22:28 UTC, Ilario Gottardello
Details
Size in inches (52.84 KB, image/png)
2021-02-10 22:29 UTC, Ilario Gottardello
Details
Size in pixels (52.81 KB, image/png)
2021-02-10 22:29 UTC, Ilario Gottardello
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ilario Gottardello 2021-01-18 14:16:07 UTC
SUMMARY

Skanlite will report an incorrect maximum resolution for the scanner (which is an HP ScanJet 3400C): 220 x 296 mm instead of 216 x 297 as stated in the HP support page: https://support.hp.com/us-en/document/bus03735/

The annoyance is that it defaults to "Custom" resolution because A4 is 210 x 297, so Skanlite thinks that this scanner is not able to scan an A4 document, which in reality is able to.

Maybe is a conversion error from pixel and ppi to mm?

STEPS TO REPRODUCE
1. Starts skanlite
2. read the "Height" box
3. 

OBSERVED RESULT
It says 296 as maximum resolution

EXPECTED RESULT
It should says 297

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 20.04, all updated
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Kåre Särs 2021-01-18 17:47:55 UTC
Thanks for the report.

Hmm.. strange... exactly this should be fixed in libksane 20.12...
libksane should have a 2mm wiggle room margin for the page sizes... 

can you run 

scanimage -L

to get the device id and then 

scanimage -d <device id> --help

then post the output here.
Comment 2 Ilario Gottardello 2021-01-18 18:31:25 UTC
$ scanimage -L
device `niash:libusb:002:010' is a Hewlett-Packard ScanJet 3400C flatbed scanner

$ scanimage -d niash:libusb:002:010 --help
Usage: scanimage [OPTION]...

Start image acquisition on a scanner device and write image data to
standard output.

Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
-d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)
    --format=pnm|tiff|png|jpeg  file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
                           can be specified: %d (device name), %v (vendor),
                           %m (model), %t (type), %i (index number), and
                           %n (newline)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
                           `out%d.png' or `out%d.jpg' by default depending on --format
                           This option is incompatible with --output-file.    --batch-start=#        page number to start naming files with
    --batch-count=#        how many pages to scan in batch mode
    --batch-increment=#    increase page number in filename by #
    --batch-double         increment page number by two, same as
                           --batch-increment=2
    --batch-print          print image filenames to stdout
    --batch-prompt         ask for pressing a key before scanning a page
    --accept-md5-only      only accept authorization requests using md5
-p, --progress             print progress messages
-o, --output-file=PATH     save output to the given file instead of stdout.
                           This option is incompatible with --batch.
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-A, --all-options          list all available backend options
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-B, --buffer-size=#        change input buffer size (in kB, default 32)
-V, --version              print version information
Output format is not set, using pnm as a default.

Options specific to device `niash:libusb:002:010':
  Geometry:
    -l 0..220mm (in steps of 1) [0]
        Top-left x position of scan area.
    -t 0..296mm (in steps of 1) [0]
        Top-left y position of scan area.
    -x 0..220mm (in steps of 1) [210]
        Width of scan-area.
    -y 0..296mm (in steps of 1) [290]
        Height of scan-area.
    --resolution 75|150|300|600dpi [150]
        Sets the resolution of the scanned image.
  Image:
    --gamma-table 0..255,... (in steps of 1)
        Gamma-correction table.  In color mode this option equally affects the
        red, green, and blue channels simultaneously (i.e., it is an intensity
        gamma table).
  Scan Mode:
    --mode Color|Gray|Lineart [Color]
        Selects the scan mode (e.g., lineart, monochrome, or color).
  Enhancement:
    --threshold 0..100% (in steps of 1) [inactive]
        Select minimum-brightness to get a white point

Type ``scanimage --help -d DEVICE'' to get list of all options for DEVICE.

List of available devices:
    niash:libusb:002:010
Comment 3 Ilario Gottardello 2021-01-18 18:32:49 UTC
$ dpkg -l | grep sane
ii  libkf5sane-data                                             20.12.1-0xneon+20.04+focal+build11        all          scanner library (data files)
ii  libkf5sane5                                                 20.12.1-0xneon+20.04+focal+build11        amd64        scanner library (runtime)
ii  libsane:amd64                                               1.0.29-0ubuntu5.2                         amd64        API library for scanners
ii  libsane:i386                                                1.0.29-0ubuntu5.2                         i386         API library for scanners
ii  libsane-common                                              1.0.29-0ubuntu5.2                         all          API library for scanners -- documentation and support files
ii  libsane-hpaio:amd64                                         3.20.3+dfsg0-2                            amd64        HP SANE backend for multi-function peripherals
ii  sane-utils                                                  1.0.29-0ubuntu5.2                         amd64        API library for scanners -- utilities
Comment 4 Kåre Särs 2021-01-18 18:46:31 UTC
Thanks,

As you can see the backend returns the 296 in stead of the 297 that it should, but it seems the wiggle-room calculation that was added does not work good enough...

The backend does return a wrong value, so it should be fixed there too...
Comment 5 Ilario Gottardello 2021-01-19 07:10:02 UTC
Ok, so should I report a bug against the backend?
May it be sensible to test the scanner on windows to see what dimensions it reports?
Comment 6 Kåre Särs 2021-01-19 14:58:03 UTC
The problem is quite probably a conversion rounding error as you wrote.

It would be nice to get the size on windows just as a reference. 

I still need to check why the fix that was done, does not seem to be working for you...

Is it possible to select A4 or is it not in the list? If A4 is in the list but not selected even if you had that set previously I think it is the "saved settings" that needs tweaking.

That said it would be nice if the back-end would return the correct size :)
Comment 7 Bug Janitor Service 2021-02-03 04:33:15 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Ilario Gottardello 2021-02-10 22:28:55 UTC
Created attachment 135581 [details]
Size in cm
Comment 9 Ilario Gottardello 2021-02-10 22:29:15 UTC
Created attachment 135582 [details]
Size in inches
Comment 10 Ilario Gottardello 2021-02-10 22:29:28 UTC
Created attachment 135583 [details]
Size in pixels
Comment 11 Ilario Gottardello 2021-02-10 22:31:46 UTC
With the original program by HP these are the maximum dimensions reported:

215.9 x 297.2 mm
8.50 x 11.70 in
1700 x 2340 pixels
Comment 12 Kåre Särs 2021-02-11 08:03:57 UTC
Thanks for the info!

I checked the source of the niash backend and there the size is hardcoded to 220x296 :{

https://gitlab.com/sane-project/backends/-/blob/master/backend/niash.c

on lines 198 and 199

I'm really astonished that this problem has not been (reported and) fixed before... the backend is from 2001... all the supported scanners have a ~216x297mm area... 

But I will have to check the libksane 2mm wiggle room implementation and check..

Are you able to select A4 or is it totally missing?

It would be nice if you could also report this to https://gitlab.com/sane-project/backends/-/issues to get the root problem fixed.

Regards,
  Kåre
Comment 13 Ilario Gottardello 2021-02-11 08:39:07 UTC
Well, I for one was bothered by this issue for years before reporting it :)

I have reported the issue to sane project: https://gitlab.com/sane-project/backends/-/issues/438
Comment 14 Kåre Särs 2021-02-11 09:26:34 UTC
Super!! Thanks :)