Bug 424010 - Add some wiggle room when determining which page size a scanner supports given the physical dimensions of its scan area
Summary: Add some wiggle room when determining which page size a scanner supports give...
Status: RESOLVED FIXED
Alias: None
Product: libksane
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: HI normal (vote)
Target Milestone: ---
Assignee: Kåre Särs
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2020-07-08 21:18 UTC by Michael
Modified: 2020-09-25 03:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 20.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2020-07-08 21:18:48 UTC
SUMMARY

The "Scan Area Size" field has useful preset page sizes like A4, but it is missing the default page size used in North America, which is "Letter" sized, or 8.5" x 11". This is also called "ANSI A", but practically speaking, no one ever calls it that.

For reference: 

https://en.wikipedia.org/wiki/Paper_size#North_American_paper_sizes
https://en.wikipedia.org/wiki/Paper_size#Standardized_American_paper_sizes


STEPS TO REPRODUCE

1. Run Skanlite
2. Look at the Scan Area Size drop-down menu.


OBSERVED RESULT

No "Letter" size.


EXPECTED RESULT

Should be able to find "Letter".


SOFTWARE/OS VERSIONS

Operating System: KDE neon 5.19
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.71.0
Qt Version: 5.14.2
Kernel Version: 5.3.0-62-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-2467M CPU @ 1.60GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa DRI Intel® Sandybridge Mobile
Comment 1 Kåre Särs 2020-07-09 16:42:36 UTC
Thanks for the report.

That is strange. Letter should be in the list. There is a mechanism to remove page sizes that do not fit the available scan area. Could it be that the size of the scan area limits the page sizes? Maybe there is a bug in that mechanism?

Can you attach the output of "scanimage -d <your-scanner-backend> -A"?

I need know the available scan area.

Thanks,
  Kåre
Comment 2 Michael 2020-07-10 07:06:44 UTC
Okay, it looks like the height is fine but the width is just shy of 8.5" even though an 8.5" sheet can fit on the bed perfectly and scan perfectly...

$ scanimage -d "plustek:libusb:003:003" -A

All options specific to device `plustek:libusb:003:003':
  Scan Mode:
    --mode Lineart|Gray|Color [Color]
        Selects the scan mode (e.g., lineart, monochrome, or color).
    --depth 8|16bit [8]
        Number of bits per sample, typical values are 1 for "line-art" and 8
        for multibit scans.
    --source Normal|Transparency|Negative [inactive]
        Selects the scan source (such as a document-feeder).
    --resolution 50..2400dpi [50]
        Sets the resolution of the scanned image.
    --preview[=(yes|no)] [no]
        Request a preview-quality scan.
  Geometry:
    -l 0..215mm [0]
        Top-left x position of scan area.
    -t 0..297mm [0]
        Top-left y position of scan area.
    -x 0..215mm [103]
        Width of scan-area.
    -y 0..297mm [76.21]
        Height of scan-area.
  Enhancement:
    --brightness -100..100% (in steps of 1) [0]
        Controls the brightness of the acquired image.
    --contrast -100..100% (in steps of 1) [0]
        Controls the contrast of the acquired image.
    --custom-gamma[=(yes|no)] [no]
        Determines whether a builtin or a custom gamma-table should be used.
    --gamma-table 0..255,... [inactive]
        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).
    --red-gamma-table 0..255,... [inactive]
        Gamma-correction table for the red band.
    --green-gamma-table 0..255,... [inactive]
        Gamma-correction table for the green band.
    --blue-gamma-table 0..255,... [inactive]
        Gamma-correction table for the blue band.
  Device-Settings:
    --lamp-switch[=(yes|no)] [no]
        Manually switching the lamp(s).
    --lampoff-time 0..999 (in steps of 1) [300]
        Lampoff-time in seconds.
    --lamp-off-at-exit[=(yes|no)] [yes]
        Turn off lamp when program exits
    --warmup-time -1..999 (in steps of 1) [inactive]
        Warmup-time in seconds.
    --lamp-off-during-dcal[=(yes|no)] [no]
        Always switches lamp off when doing dark calibration.
    --calibration-cache[=(yes|no)] [no]
        Enables or disables calibration data cache.
    --speedup-switch[=(yes|no)] [inactive]
        Enables or disables speeding up sensor movement.
    --calibrate [inactive]
        Performs calibration
  Analog frontend:
    --red-gain -1..63 (in steps of 1) [-1]
        Red gain value of the AFE
    --green-gain -1..63 (in steps of 1) [-1]
        Green gain value of the AFE
    --blue-gain -1..63 (in steps of 1) [-1]
        Blue gain value of the AFE
    --red-offset -1..63 (in steps of 1) [-1]
        Red offset value of the AFE
    --green-offset -1..63 (in steps of 1) [-1]
        Green offset value of the AFE
    --blue-offset -1..63 (in steps of 1) [-1]
        Blue offset value of the AFE
    --redlamp-off -1..16363 (in steps of 1) [-1]
        Defines red lamp off parameter
    --greenlamp-off -1..16363 (in steps of 1) [-1]
        Defines green lamp off parameter
    --bluelamp-off -1..16363 (in steps of 1) [-1]
        Defines blue lamp off parameter
  Buttons:
    --button 0[=(yes|no)] [no] [hardware]
        This option reflects the status of the scanner buttons.
    --button 1[=(yes|no)] [no] [hardware]
        This option reflects the status of the scanner buttons.
    --button 2[=(yes|no)] [no] [hardware]
        This option reflects the status of the scanner buttons.
    --button 3[=(yes|no)] [inactive]
        This option reflects the status of the scanner buttons.
    --button 4[=(yes|no)] [inactive]
        This option reflects the status of the scanner buttons.
Comment 3 Nate Graham 2020-09-21 16:45:21 UTC
I see an entry called "Letter / ANSI A" in the dropdown on mine. So I guess we need to add a bit of wiggle room for weird scanners that have a scan area which is millimeters smaller than what is needed for a particular size.
Comment 4 Michael 2020-09-22 04:56:53 UTC
Yes, just a few millimeter epsilon would be helpful.

For example my scanner says it supports a width of 215mm, which is 8.46457 inches. Because it's less than 8.5 inches, owners of this scanner won't see the 8.5" Letter sized scan area. 

However if we were a bit more forgiving, wiggling by one more mm of width, like 216mm, that would make all the difference because that equals 8.50394 inches.

So if Skanlite had a wiggle factor of a few mm when filtering to show supported supported scan areas, that would be helpful.
Comment 5 Nate Graham 2020-09-22 17:54:54 UTC
Looks like this needs to be fixed in libksane, not skanlite
Comment 6 Kåre Särs 2020-09-24 18:30:29 UTC
Git commit a997d11d72166922db14dd93b0cf83f402d3a5a8 by Kåre Särs.
Committed on 24/09/2020 at 18:24.
Pushed by sars into branch 'master'.

Add wiggle room for page sizes to fit in the scan-area

Some scanners report scan-areas that are just a tiny bit smaller than
a page size (Letter does not fit in 215mm width). Add all page sizes
that would fit if the scan area would be 2mm wider or higher.

M  +10   -9    src/ksanewidget_p.cpp

https://invent.kde.org/graphics/libksane/commit/a997d11d72166922db14dd93b0cf83f402d3a5a8
Comment 7 Nate Graham 2020-09-24 18:34:08 UTC
Thanks Kåre!

I wonder if 2mm might be a bit small, but I suppose it's easy to adjust in the future now, if we need to. :)
Comment 8 Michael 2020-09-25 03:49:03 UTC
Thank you Kåre :) Yes, this will help for the rounding error that my scanner reports.