Support sane option --scan-area
Brought to you by:
ra28145
Several sane backends provide the option --scan-area to guarantee the scan is correctly aligned, even if the scan area with automatic document feeder (ADF) is right-aligned in contrast to the flatbed of the same device, which is normally left-aligned.
Currently on Ubuntu gscan2pdf seems only to support options -l -t -x -y, which leads to misalignment of some scanners when using the ADF.
As example for this problem see: https://gitlab.com/utsushi/utsushi/issues/68
Please start gscan2pdf from the command line with the --log=log options, reproduce the problem, quit, and post the log file, which gscan2pdf should have compressed with xz.
Here it is ...
Thanks for the log file. It looks to me as if you are setting scan-area, as well as br-y, br-x, and tl-x.
If you delete or rename ~/.config/gscan2pdfrc, start gscan2pdf, and then only set source=ADF and scan-area=A4, it the scan still misaligned?
With cleaned config: This is what I get, if I first set ADF and then scan area to A4
Last edit: CoSoCo 2021-07-06
With cleaned config: This is what I get, if I first set scan area to A4 and then ADF
Last edit: CoSoCo 2021-07-06
Here an example, where I don't remember which settings I've used in which order, but this has worked fine except that the right-hand border is 1 mm too large.
I too have the problem, that I can't scroll in the image view. I can zoom with the mouse wheel, but there are no sliders to scroll. I don't know what the pan tool is for, but the button is always pushed. I can not unselect it by mouse click.
What is the difference between scan area, paper size and quick format?
Last edit: CoSoCo 2021-07-06
Can you give me another log file, please, following what you did for one of the two TIFs?
Additionally, what do you get from the following from the command line:
?
Your 1st question I don not understand. Can you explain more detailed?
Here is what I get from scanimage.
Here also the right-hand border is 1 mm too large.
Is there a way to directly compress a tif file with G4 with scanimage to get a much smaller file?
Last edit: CoSoCo 2021-07-05
I'm guessing that
scanimage -o out.tifwill guess that the output should be TIF. Alternatively,--formatshould work, too.I meant before that the first two TIFs looked too tall, and now that you have cleaned the config file, I'd like to understand from a fresh log file what is going on. So please start gscan2pdf, and then only set source=ADF and scan-area=A4, quit and post the new log file.
Last edit: Jeffrey Ratcliffe 2021-07-05
I know this options, but AFAIK they don't allow to set a compression. But I have found this workaround:
scanimage --source='Automatic Document Feeder' --scan-area=A4 | convert - -compress Group4 "scanimage area_A4 G4.tif"Surprisingly this caused a file size of 230 kb, whereas gscan2pdf only needed 100 kb in G4 mode. Is there a preprocessing in gscan2pdf, which optimizes the image, e.g. from noise?
This is exactly what I did in the first 2 examples, with alternating order of setting the 2 options. It is surprising to me too, that anyway maximum size was processed. I have no idea, in which way I may have misunderstood you.
Only in the 3rd example I got the right result. I don't remember the exact order of options I used, but I hoped you could see this from the log file.
Last edit: CoSoCo 2021-07-05
Group3 and 4 only works for bilevel - black & white, not greyscale - images.
I'm guessing that the default scan mode is greyscale, which Group4 can't compress, so convert is probably just ignoring it and using something like Flate instead. What does
tiffinfosay about the file?I don't see a log file after you cleaned your config. Where did you put it?
Oh god, now I understand. There must have happened an error when uploading 2 files at a time. Now I have uploaded the 3 missing log files. Sorry for my overlooking.
The result with scanimage + imagemagick convert:
The result with gscan2pdf:
Maybe the threshold for black/white is different between gscan2pdf and imagemagick. Also note the difference with the Photometric Interpretation value.
Last edit: CoSoCo 2021-07-06
I too have the problem, that I can't scroll in the image view. I can zoom with the mouse wheel, but there are no sliders to scroll. I don't know what the pan tool is for, but the button is always pushed. I can not toggle it by mouse click.
And can you tell me what is the difference between scan area, paper size and quick format?
Last edit: CoSoCo 2021-07-06
To use the pan tool, hold the left mouse button down in the image view and drag. If the screen is split so the text is also visible, the text should be panned with the image.
scan areaandquick formatare options offered by the backend.paper sizeis added by gscan2pdf for those backends (like mine) that don't havescan area.I expect you are right. The different black/white and threshold settings meant that the image from gscan2pdf had much more white in it, which group4 could compress much better.
This does not work. In the image view I see a cross-sized cursor, and when I drag it, an area becomes selected. The pan tool button is selected from start and I cannot toggle it.
Also the text edit button is selected from start, and I can't unselect it.
But when I choose"pan & select", the pan tool button becomes unselected. If I select it again,, I see a finger-pointing cursor and I can move the image with dragging the mouse.
I have no idea, what the "pan & select"-function is good for.
Last edit: CoSoCo 2021-07-06
I've just seen the following bug in the image controls, which is probably what is confusing you: The controls default to the "pan & select" tool, but the icon defaults to the pan tool. I'll fix this.
It should work as follows:
Don't forget, that the text edit button has the same problem.
What do you mean by this? Are you talking about panning and scrolling the text (i.e. OCR output) window?
I would like a more fine grained zoom, e.g. like in IrfanView. There it is:
1;2;3;10;14;16;19;21;25;28;33;38;43;50;57;66;76;87;100;115;132;150;174;200;230;260;300;350;400;450;500;600;700;800;900;1000;1200;1400;1600;2000;3000;
I have a very fine grained mouse wheel and an older CPU, so when I turn the mouse wheel just a little, I first have no reaction and then a biiig jump after few seconds. So it is very uncomfortable to zoom with the mouse wheel here.
But what about the main problem about the wrong alignment of ADF scans with my Epson WF-2630 ???
In the case of this comment, I remember, that the left edge value (l) was automatically set to 6 mm (exactly it should be 5.9 mm), the width (x) to 210 mm and the height (y) to 297 mm, which is the correct setting for right-aligning ADF scanners such as my Epson WF-2630. Unfortunately I don't remember the order of actions I did for this.
Anyway, I don't think, it is the right way to change the y,y,w,h settings upon switching to ADF.
Imagine, one would like his scan cropped by 20 mm, then in case of ADF he should enter 25.9 mm.
Better make use of the
--scan-areaoption.Last edit: CoSoCo 2021-07-07
Note, that I've edited my last post.
For comparative examples with
scanimagesee here: https://gitlab.com/sane-project/frontend/xsane/-/issues/1#note_621030059In both gscan2pdf ADF_A4.log.xz (sourceforge.net) and gscan2pdf A4_ADF.log.xz (sourceforge.net), first scan-area=A4, and then source=ADF was selected. It looks as though the ADF overwrites the geometry settings.
It is a bug in the backend, that ADF overwrites the geometry settings without unsetting the scan-area option, or setting it to max, or something like that.
Would you mind please having another go and setting first the ADF, and second the scan-area, and posting the log file and image?
Oh, it seems, that I was in error. Here are the new files.
Additionally I've filed a bug report: https://gitlab.com/utsushi/utsushi/-/issues/68#note_621557725
In the mean time please create a workaround in gscan2pdf.
Last edit: CoSoCo 2021-07-08
The bug is not that the order of arguments is important - but that having first set A4, and then ADF, that scan-area is not set to max - i.e.
scanimage --scan-area=A4 --source='Automatic Document Feeder' --helpstill lists scan-area as A4, not max.