OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Applications => Topic started by: Jan-Erik Lärka on December 16, 2024, 08:58:30 pm

Title: PMInSANE :-P
Post by: Jan-Erik Lärka on December 16, 2024, 08:58:30 pm
I've put togheter this GUI application... nothing fancy, but fun.
It just work and scan stuff on my CanoScan LiDE 25 on both my laptop and workstation with SANE 1.0.27 from Paul Smedley.

Possible parameters with examples/alternatives/info:
-DEVICE plustek:libusb:001:001   (Force the use of a certain device)
-MODE Color                 ( BW, 8G, RGB, Color, ... )
-UNIT cm                       ( mm, cm, inch )
-DPI 300                        ( 75, 150, 300, 600, ... )
-O  C:\Temp                   ( C:\Temp\MyScannedImage )
-AREA 10 10 50 50       ( Left Top X Y )
-BATCH                         (Run in batch mode and return after scan)
Title: Re: PMInSANE :-P
Post by: Paul Smedley on December 16, 2024, 09:02:46 pm
Cool!!! I should look at building the latest SANE...
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 17, 2024, 03:04:01 am
Jan-Erik!

Very cool...I do quite a bit of scanning on my HP 6390C scanner (automotive hobby and so many VERY LARGE parts books to digitize LOL), so this is very handy indeed.

In fact, I had previously written a REXX script which allowed me to basically pass various parameters to drive the scanner with. All of my post-processing is then done in PMView which is called automatically once the scanner job completes.

What I particularly love about your approach is the abiility to do a quick assessment (Preview, yes?) and immediate cropping of the interested area!!!

OK, so from a feedback perspective (where I hope you do not object to the "umm, can we made this better?" parts):

1) Your app recognized my HP ScanJet 6390C (63X0C, Model C7670A, Rev=3945) scanner w/o any problems...it is USB aattached and currently working with, NICE!

2) I have WPS set to auto-focus and move cursor to pop-up windows/buttons (centering over them) and your handy pop-up 'Help' buttons cause my cursor to immediately get re-positioned over them, which honestly makes trying to use the app very hard

3) Any chance to create a 'Settings' page where perhaps some of the stuff (like the pop-ups) could be turned ON/OFF?

4) Any chance to account for:
- dynamic file creation filename
- passing the file to another app like PMView
- file image choice: JPEG, TIFF, BMP, etc

Alright...that's all, the effort is greatly appreciated, so Thank You!!!

-Dariusz

BTW: I had a couple of crashes, are you interested in seeing these?
Title: Re: PMInSANE :-P
Post by: Pete on December 17, 2024, 06:36:43 am
Hi Dariusz

Maybe HPscan would be worth a try http://hobbesarchive.com/Home/Download?path=/Hobbes/pub/os2/apps/graphics/scan/HPscan_1-00.zip


Regards

Pete
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 17, 2024, 07:34:28 am
Jan-Erik!

Very cool...I do quite a bit of scanning on my HP 6390C scanner (automotive hobby and so many VERY LARGE parts books to digitize LOL), so this is very handy indeed.

In fact, I had previously written a REXX script which allowed me to basically pass various parameters to drive the scanner with. All of my post-processing is then done in PMView which is called automatically once the scanner job completes.

What I particularly love about your approach is the abiility to do a quick assessment (Preview, yes?) and immediate cropping of the interested area!!!

OK, so from a feedback perspective (where I hope you do not object to the "umm, can we made this better?" parts):

1) Your app recognized my HP ScanJet 6390C (63X0C, Model C7670A, Rev=3945) scanner w/o any problems...it is USB aattached and currently working with, NICE!

2) I have WPS set to auto-focus and move cursor to pop-up windows/buttons (centering over them) and your handy pop-up 'Help' buttons cause my cursor to immediately get re-positioned over them, which honestly makes trying to use the app very hard

3) Any chance to create a 'Settings' page where perhaps some of the stuff (like the pop-ups) could be turned ON/OFF?

4) Any chance to account for:
- dynamic file creation filename
- passing the file to another app like PMView
- file image choice: JPEG, TIFF, BMP, etc

Alright...that's all, the effort is greatly appreciated, so Thank You!!!

-Dariusz

BTW: I had a couple of crashes, are you interested in seeing these?

I'd like to see the crashes.

I understand your point regarding autofocus, now that you mention it.
I'll have to think about how to do it, as the bubble help use a hidden input field to get triggered.
It should be doable with a setting, a nice Christmas task to turn autofocus on and off.

The library rxImgSze depend on the version of GBM installed. Ensure you have a recent version (GBM 1.77), and it can convert between formats.
-O redirect the output and the file name depend on if you specify a \ last or not and if it is a folder name.

If PMView could call this app it would alse be able to grab the output (though as pnm or bmp at present)

I've created another app that use this one to scan invoices (Swedish) ocr the output and then calculate the check sum to verify the invoice information.
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 18, 2024, 09:38:27 pm
Hello,

here's a new version that should address the needs mentioned so far.

1. Tooltip now disabled by default  ( Activate with a button )
2. The Scanned image can open in one instance PMView ( Activate with a button )
3. "Crash" occured during close if no Color was selected.

Note!
Click the button to the left of Preview to see the fields with numbers to adjust the cropping area.
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 19, 2024, 05:43:09 am
Hi Jan-Erik

Hello,

here's a new version that should address the needs mentioned so far.

1. Tooltip now disabled by default  ( Activate with a button )
2. The Scanned image can open in one instance PMView ( Activate with a button )
3. "Crash" occured during close if no Color was selected.

Note!
Click the button to the left of Preview to see the fields with numbers to adjust the cropping area.

Nice...thank you! I'm checking it out...have some visual artifacts that show up when the app starts but I'm not quite sure what's causing it...I'm running SNAP drivers here on a dual-head monitor config...let me try a few things first!
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 19, 2024, 10:16:59 am
The visual artefacts appear here as well. it's part of DrDialog but resolv if you adjusst the window size >>>>slightly<<<< so that it can recalculate the position of controls and reposition/redraw them.


Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 19, 2024, 07:41:23 pm
Hi Pete!

Maybe HPscan would be worth a try http://hobbesarchive.com/Home/Download?path=/Hobbes/pub/os2/apps/graphics/scan/HPscan_1-00.zip

You know, that's an excellent little app indeed. I was not aware that it existed, and it does certainly accomplish everything that my REXX script based stuff does, albeit in a nifty and easier to use GUI format. Short of a few image control type of things (like scanning into a default TIFF format), this is spot-on.

Thank you for bringing this up.

BTW:
HPscan, despite it's name can in fact be used by multiple scanner devices, which the author calls out in the readme file, although judging by app name only this may not be so obvious. The key stipulation here is that you would need the full SANE backend installed along with the appropriately configured device specific sane conf file. Otherwise, the hpaoi and hplib would be used directly by the HPscan, but for HP scanners only in that case.
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 19, 2024, 09:06:48 pm
Hello Jan-Erik!

The visual artefacts appear here as well. it's part of DrDialog but resolv if you adjusst the window size >>>>slightly<<<< so that it can recalculate the position of controls and reposition/redraw them.

Yup, and honestly these are tiny things, so easy to deal with.

OK good stuff, this is working well.

So can I 'push my luck" some more??? LOL

How about the other additional feature request:

1) could we add the file format choice?
I prefer to save my old Auto Parts Books scans in TIFF and optionally do some post processing on these in PMView, etc.

BUG REPORT
=========

1) CROP function, in my case the crop is incorrect, meaning the wrong part of the image is cropped. Take a look please at the attachments.

2) DEVICE select doesn't work: using "-DEVICE hp:libusb:003:001" in the program object parameter field results in that initial pop-up progress window just being blank, and any scanner commands afterwards do not produce any results

EDIT => nope, turns out that passing ANY parameters causes the outcome I wrote above, it is not just the '-DEVICE' one which I initially thought...passing '-O Y:\tmp' (which is my RAMDISK) produces the same result.
Title: Re: PMInSANE :-P
Post by: Remy on December 20, 2024, 11:28:10 pm
Do you think Brothers scanner (which has sane drivers) can be made working ?
e.g. ADS-1600W 
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 21, 2024, 09:45:34 am
Hello Jan-Erik!

The visual artefacts appear here as well. it's part of DrDialog but resolv if you adjusst the window size >>>>slightly<<<< so that it can recalculate the position of controls and reposition/redraw them.

Yup, and honestly these are tiny things, so easy to deal with.

I'm adding code to set the(same)  resource id after it has resized to allow it to redraw and hope that it will improve things for most cases.

OK good stuff, this is working well.

So can I 'push my luck" some more??? LOL

How about the other additional feature request:

1) could we add the file format choice?
I prefer to save my old Auto Parts Books scans in TIFF and optionally do some post processing on these in PMView, etc.

I'm looking in to that.

BUG REPORT
=========

1) CROP function, in my case the crop is incorrect, meaning the wrong part of the image is cropped. Take a look please at the attachments.

Have you seen the little button that should resemble a ruler (1...2] to the left?
Click on it and entry fields appear (though sometimes not fully visible).
That's the numbers (in mm) that it send to sane, and visible in the title bar during scan.
I suspect that sane ignore them, or that this backend perhaps require other parameters?
PMInSANE currently query the found scanner for information as it launch.
'@scanimage -h -d' device '|RXQUEUE'
and determine vertical range with
PARSE VALUE tmp WITH '-t'nt'..'xt'mm'
can you send me the output of:
'@scanimage -h +-d' device '>scan.log'

2) DEVICE select doesn't work: using "-DEVICE hp:libusb:003:001" in the program object parameter field results in that initial pop-up progress window just being blank, and any scanner commands afterwards do not produce any results

Yes, as you override the procedure to query the scanner, it doesn't show "progress", just pop up the main window when ready.
It just pass the parameter on to scanimage.exe and here it (scanimage.exe) hummmm and cause the scanner to scan, but I only have this one.
But scanimage doesn't even start as you add the parameter? I've only seen that scanimage refuse to do anything (just stall) in combination with chkdisk and had to restart the computer and use scanimage before chkdisk.

EDIT => nope, turns out that passing ANY parameters causes the outcome I wrote above, it is not just the '-DEVICE' one which I initially thought...passing '-O Y:\tmp' (which is my RAMDISK) produces the same result.
Strange, restart the computer and try again  ;D
Here it scanimage send the output to -O C:\var\temp\
Note the trailing \ try that as well

Is it possible to write tmp.pnm on Y: as the parameter you've set suggest?
and Y:\tmp.pnm isn't blocked?
Title: Re: PMInSANE :-P
Post by: Pete on December 22, 2024, 03:37:58 pm
Hi Jan-Erik

The "Crop" problem Dariusz reports could be the result of the differences between an OS/2 screen and every other pc os screen - OS2/2 starts at Bottom Left as 0,0 whereas Windows, linux etc start at TOP Left as 0,0.


Regards

Pete

Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 25, 2024, 11:54:06 am
Hello,

Here's and updated version that create output as TIFF, PNG and JPEG, specify "-FMT TIFF", "-FMT PNG" or -FMT JPEG" as parameter to set the output format.
The backend here can't produce anything else but PNM (PPM) so the library convert the files to above file formats (and BMP that the viewer need).

Have also included a little app that use PMInSANE to get only a portion of the area and also need gocr.
Here in Sweden payments go through BankGiro or PostalGiro, that use the font "OcrB" (Bold) at the bottom part of the paper.
The payment number use Luhn calculation to ensure that the numbers are correct, and such a calculation is included in the app.
If the preceeding number doesn't add upp, the information show in red text (__ should have been 14 or 41 depending on ...).
The gray areas should show a clipboard like button, but it has to be improved to show up properly.

Hi Jan-Erik

The "Crop" problem Dariusz reports could be the result of the differences between an OS/2 screen and every other pc os screen - OS2/2 starts at Bottom Left as 0,0 whereas Windows, linux etc start at TOP Left as 0,0.


Regards

Pete

Here crop produce the output I expect, x to the side and y pixels down, but at times sane or the backend fail to recognize the width.
Can't do much unless sane handle the parameters.
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 25, 2024, 12:01:21 pm
Hello,

I really like your HPScan, it is an inspiration and clean and efficient interface to the user.
If one can set a parameter like /Sin=PMV123 and the file to the viewer, it can hand over the image to PMView without starting a new instance.
Envy those who develop with WDSybil, seem to contain so much more controls than other tools.

Hi Dariusz

Maybe HPscan would be worth a try http://hobbesarchive.com/Home/Download?path=/Hobbes/pub/os2/apps/graphics/scan/HPscan_1-00.zip


Regards

Pete
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 26, 2024, 02:31:23 am
Hello Jan-Erik,

Here's and updated version that create output as TIFF, PNG and JPEG, specify "-FMT TIFF", "-FMT PNG" or -FMT JPEG" as parameter to set the output format.
The backend here can't produce anything else but PNM (PPM) so the library convert the files to above file formats (and BMP that the viewer need).

Hmm...not sure what's happened but this verison won't fire up PMView anymore, can I do anyting to troubleshoot this further?

I did delete the App Key from OS2.INI thinking that maybe there was something there confusing it (verison change, etc....just guessing on my part), but that did nothing.

Hi Jan-Erik

The "Crop" problem Dariusz reports could be the result of the differences between an OS/2 screen and every other pc os screen - OS2/2 starts at Bottom Left as 0,0 whereas Windows, linux etc start at TOP Left as 0,0.

Pete

Here crop produce the output I expect, x to the side and y pixels down, but at times sane or the backend fail to recognize the width.
Can't do much unless sane handle the parameters.

When attempting to do a CROP the little pop-up measuring fields never pop up here, just a LMB down starts a BLUE line, keeping LMB down and dragging it over and releasing now converts that BLUE line into GREEN and creates a NEW BLUE line to close the CROP box I had created.

I've got to tell ya, that's very counter-inuitive for me, but that's just me being used to a dynamically dragged CROP box. I suspect this may have a lot do to with DrRexx stuff seeing as the CROP fields themselves are missing as well?

Also, tried the Program Ojbect parameter passing, nothing, and absolutely nothing I did worked.
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 26, 2024, 02:37:52 am
...oh, one more thing:

...The backend here can't produce anything else but PNM (PPM) so the library convert the files to above file formats (and BMP that the viewer need)...

1.0.28 sane here and "--format tiff" creates the TIFF stuff, which is consistent with what I see on the SANE man page here => http://www.sane-project.org/man/scanimage.1.html (http://www.sane-project.org/man/scanimage.1.html):

Code: [Select]
--format=output-format
              selects how image data is written to standard output or the file
              specified by the --output-file  option.   output-format  can  be
              pnm,  tiff,  png, or jpeg.  If --format is not specified, PNM is
              written by default.

I suspect you have an opportunity here to just use the scanimage out-of-the-box functionality...can't speak for 1.0.27 though...maybe that's the difference you are seeing, as I am not familiar with prior versions???
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 26, 2024, 09:24:35 am
Hello Jan-Erik,

Here's and updated version that create output as TIFF, PNG and JPEG, specify "-FMT TIFF", "-FMT PNG" or -FMT JPEG" as parameter to set the output format.
The backend here can't produce anything else but PNM (PPM) so the library convert the files to above file formats (and BMP that the viewer need).

Hmm...not sure what's happened but this verison won't fire up PMView anymore, can I do anyting to troubleshoot this further?

I did delete the App Key from OS2.INI thinking that maybe there was something there confusing it (verison change, etc....just guessing on my part), but that did nothing.
You were quite right.
Added and renumbered the controls, but missed a couple of places that caused it. See attached and updated package.
Hi Jan-Erik

The "Crop" problem Dariusz reports could be the result of the differences between an OS/2 screen and every other pc os screen - OS2/2 starts at Bottom Left as 0,0 whereas Windows, linux etc start at TOP Left as 0,0.

Pete

Here crop produce the output I expect, x to the side and y pixels down, but at times sane or the backend fail to recognize the width.
Can't do much unless sane handle the parameters.

When attempting to do a CROP the little pop-up measuring fields never pop up here, just a LMB down starts a BLUE line, keeping LMB down and dragging it over and releasing now converts that BLUE line into GREEN and creates a NEW BLUE line to close the CROP box I had created.

I've got to tell ya, that's very counter-inuitive for me, but that's just me being used to a dynamically dragged CROP box. I suspect this may have a lot do to with DrRexx stuff seeing as the CROP fields themselves are missing as well?

Also, tried the Program Ojbect parameter passing, nothing, and absolutely nothing I did worked.

Click the button to show the values for crop... (see image with the bubble help).
RMB clear crop area selection btw.
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 26, 2024, 09:44:42 am
...oh, one more thing:

...The backend here can't produce anything else but PNM (PPM) so the library convert the files to above file formats (and BMP that the viewer need)...

1.0.28 sane here and "--format tiff" creates the TIFF stuff, which is consistent with what I see on the SANE man page here => http://www.sane-project.org/man/scanimage.1.html (http://www.sane-project.org/man/scanimage.1.html):

Code: [Select]
--format=output-format
              selects how image data is written to standard output or the file
              specified by the --output-file  option.   output-format  can  be
              pnm,  tiff,  png, or jpeg.  If --format is not specified, PNM is
              written by default.

I suspect you have an opportunity here to just use the scanimage out-of-the-box functionality...can't speak for 1.0.27 though...maybe that's the difference you are seeing, as I am not familiar with prior versions???

All versions that actually do something useful output pnm (see PPM in the image) only, so the safe route is to go with what is available and work from there.
I've used the parameter and the versions tested do output files, but when examined the internal file format written is still pnm.
The extension thus deviate from the actual data format it report, open a file with PMView by hand and see if it really is of the file format it pretend to be.
The conversion library rxImgSze has been designed to report such problems but not work with those, unless manually fixed.

I consider 1.0.28 to not work... it does nothing here but sigsegv when used with parameters needed to determine the scanner and its capabilities.
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 26, 2024, 08:48:58 pm
Hello Jan-Erik!

Hmm...not sure what's happened but this verison won't fire up PMView anymore, can I do anyting to troubleshoot this further?

I did delete the App Key from OS2.INI thinking that maybe there was something there confusing it (verison change, etc....just guessing on my part), but that did nothing.
You were quite right.
Added and renumbered the controls, but missed a couple of places that caused it. See attached and updated package.

Yup...that works!!! Thank you...

When attempting to do a CROP the little pop-up measuring fields never pop up here, just a LMB down starts a BLUE line, keeping LMB down and dragging it over and releasing now converts that BLUE line into GREEN and creates a NEW BLUE line to close the CROP box I had created.

I've got to tell ya, that's very counter-inuitive for me, but that's just me being used to a dynamically dragged CROP box. I suspect this may have a lot do to with DrRexx stuff seeing as the CROP fields themselves are missing as well?

Click the button to show the values for crop... (see image with the bubble help).
RMB clear crop area selection btw.

OK, I got it now. So that's actually a 'toggle switch', because I see that selecting it once persists the field pop-up screen and it will continue to show as long as I do not disable it. OK, that works!

While I played with this I noticed a couple of things, although I suspect if you are not seeing this the root cause here must be either the DrRexx library, or the video drivers:

1) first time selecting the crop coordinates pop-up fields actually shows BLANK fields
2) disabling those fields from showing and re-enabling them rigth away now causes them to show, but the bottom right one is displayed missing the field layout...this gets corrected as you move to other sections and re-set the crop coordinates, see attachments that show this

Alright, so now that I understood how the crop selection works I did a bit more testing trying to understand why the actual crop selection does not match what I select on the screen.

The last attachment shows the result of the following PMinSANE 'scanimage' CLI:

Code: [Select]
Program (actual)    = "G:\USR\BIN\SCANIMAGE.EXE"
Program (specified) = "scanimage"
Parameters = " -p -d hp:libusb:003:001 -l 13 -t 211 -x 205 -y 47 --mode Color --resolution 300  "

I pulled this from Theseus, and so I interpret that to mean:

1) "-l" : top-left X position
2) "-t" : top-left Y position
3) "-x" : width
4) "-y" : height

which in turn translates to (as applicable to the scan page): 13 mm x 211 mm to 218 mm x 258 mm.

As a final sanity-check I took the 'problem' parms and fed scanimage from CLI, the outcome was the same as through PMinSANE, which means: problem is in the HP backend.

For what it's worth the following geometry description is returned by "scanimage -h":

Code: [Select]
Geometry:
  -l 0..215.788mm (in steps of 1.52588e-05) [0]
      Top-left x position of scan area.
  -t 0..296.888mm (in steps of 1.52588e-05) [0]
      Top-left y position of scan area.
  -x 0..215.788mm (in steps of 1.52588e-05) [215.788]
      Width of scan-area.
  -y 0..296.888mm (in steps of 1.52588e-05) [296.888]
      Height of scan-area.

So it looks like those parameters should be fine, alas that's just not the outcome I'm seeing.
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 26, 2024, 08:58:53 pm
All versions that actually do something useful output pnm (see PPM in the image) only, so the safe route is to go with what is available and work from there.
I've used the parameter and the versions tested do output files, but when examined the internal file format written is still pnm.
The extension thus deviate from the actual data format it report, open a file with PMView by hand and see if it really is of the file format it pretend to be...

Hmm...that's all very strane to me seeing as the official SANE docs do clearly state that the output file format is completely user selectable given a few standard formats it provides. They all simply work here (as in: hands-on testing with multiple options as almost all of my TIFFs are converted to PDF pages and assembled into multi-page PDF documents), nothing else is needed.

Again, maybe 1.0.27 is different in that aspect, I cannot comment but I've attached a full 'Image Info' PMView screenshot of a CLI created TIFF file and that's no PNM image, that's a genuine TIFF. Heck, scanimage has the capability for you to even feed it a "ICC profile", so you bet it does it.
Title: Re: PMInSANE :-P
Post by: Roderick Klein on December 26, 2024, 10:45:51 pm
Hello everyody,

Best wishes for 2025 in advanced.
Just a thought why do we not use:
https://www.os2world.com/wiki/index.php/Tame/2
I seem to recall its possible to add scanners to this project ?
Or have I overlooked something ?

Roderick
Title: Re: PMInSANE :-P
Post by: Pete on December 27, 2024, 07:33:13 am
Hi Roderick

Seasons Greeting  :-)

No point in looking at using Tame/2 if you have a HP scanner using hpaio as tame/2 does not understand the necessary uri format required by hpaio.


Regards

Pete
Title: Re: PMInSANE :-P
Post by: Jan-Erik Lärka on December 28, 2024, 11:32:51 am
Hello everyody,

Best wishes for 2025 in advanced.
Just a thought why do we not use:
https://www.os2world.com/wiki/index.php/Tame/2
I seem to recall its possible to add scanners to this project ?
Or have I overlooked something ?

Roderick

Thank you, and the best of wishes to you as well.

Tame/2 is the most complete package out there, but why "add scanners"?
SANE at the time apparently didn't list found/attached scanner(s), nor their capabilities, right?
So that information had to be assembled into scanner.dat (see image)
Since a long time ago scanimage have had the capalibity to list attached/found scanners and their capablilites as it seem to me. Detection may have been easier on LapTops than on Workstations, but improved with later versions, though sigsegv appear with recent versions.

It wasn't always easy to find out how to state the settings to run scanimage, that has changed over the years, but the auto detection and listing improved things, if one was brave enough to run it on the command line.

This thread confirm that it is possible to do automatic detection of the scanner information and capabilities. It also indicate that I'm not alone to see one file output image format and crop issue aint isolated to my setup/equipment here.

In 2018 I had to look for something that could make it run with my workstation, but there where none. Looked at the project sane2twain that would be nice to combine, but it relied on a tweaked and specific version library that wouldn't allow updates easily.

I do dislike (think of a stronger series of words and curses) compiler specific calling conventions and versions that restrict updates of libraries. Things depending on libraries should be able to use whatever version is available, perhaps nag about it and mention the lack of capabilities, but not require a specific version to the second decimal. So I looked at writing my own, and did rewrite scanimage to the point where it output image data as pnm with defaults. I even bridged problems with calling conventions to some extent, but was unable to continue as my openwatcom compiled code at a late stage could not adjust/get the actual numbers for some setting in a gcc generated library. No I don't do gcc. (period)

Another possibility was to create a generic* library that would run the available scanimage.exe asyncrounously and control its output as it run. I still need more information how to create something that can both work with java.exe, sqlite3.exe and scanimage.exe etc. thus redirect, use and not block stdin, stdout and stderr.

One can of course use
scanimage -parameter|RXQUEUE
as in this specific case* as it doesn't require input on the command line, threaded as this to get output and progress as it appear.

*It has to be useful in more than with just one specific situation, version or application... reread the section about dislike for version specific libraries above!
Title: Re: PMInSANE :-P
Post by: David McKenna on December 28, 2024, 02:53:03 pm
 It is possible to add a scanner to scanner.dat by using the INI editor that came with FM/2, renamed scanner.ini. It is fairly human readable and I was able to figure out the various settings available by reading the settings used by the other scanners in the file. Took a bit of time though, and I don't even have the printer the scanner was on anymore...

Regards,
Title: Re: PMInSANE :-P
Post by: Remy on December 28, 2024, 03:45:40 pm
Cool!!! I should look at building the latest SANE...

It would be nice (supporting latest scanners like brother scanners...)
Brothers scanners are sane compatible
Title: Re: PMInSANE :-P
Post by: Dariusz Piatkowski on December 28, 2024, 06:38:17 pm
Hello Roderick,

..Just a thought why do we not use:
https://www.os2world.com/wiki/index.php/Tame/2
I seem to recall its possible to add scanners to this project ?
Or have I overlooked something ?...

All the best to you in 2025 as well!

To me it's simply a matter of quickness/convenience: Tame/2 is configured and fully functioning here...it's just that too often I simply want to run a quick scan of a page w/o having to fire up the whole "machinery"...lol, so maybe I'm overblowing it a bit, but when all I want is a 600DPI B/W scan b/c I'm going to pipe that through PMView and off to PDFMergeNX...well, so much easier to do this once a REXX custom solution is configured, then to manually repeat the same process in individual applications.

Tame/2 is great for a number of things, such as taking advantage of the ADF feeder on my HP scanner for example, perhaps doing some post-processing for magazine article pages and so on (de-screen), but otherwise it's just 'too big' for about 95% of the stuff I need to do with a scanner.

Subsequently, whether it's Jan-Erik's PMinSANE, or Pete's HPScan, these are much smaller with a sub-set of features you'd find in something like Tame/2 and that's what makes for a quick START=>FINISH workflow.
Title: Re: PMInSANE :-P
Post by: Pete on January 31, 2025, 02:43:45 am
Hi All

Jumping in a bit late on the discussion about file types that scanimage (should) output ie pnm, jpeg, tiff and png but I have to agree with Jan-Erik: scanimage cannot produce jpeg files - or png files. While it is possible to get files with those extensions from scanimage they are PPM (PMN) file types. As Jan-Erik says PMView can display the file type so easily checked.

I used the command line to try scanning to jpeg and png. Here are the command lines used and the results:-

scanimage -d hpaio:/net/envy_photo_6200_series?ip=192.168.1.252 --format=jpeg --mode Color --resolution 300 >J:\Programs\HPscan\work\TestScan_format.jpg
Result:
Image Type: JPEG
Scrambled image...  PMView reports "Corrupt JPEG data: premature end of data segment"
scanimage trap -> 679abf15-003d_02-SCANIMAGE-exceptq.txt
*Unable to scan successfully using --format=jpeg option

scanimage -d hpaio:/net/envy_photo_6200_series?ip=192.168.1.252 --format=png --mode Color --resolution 300 >J:\Programs\HPscan\work\TestScan_format.png
Result:
Blank/Black image...  PMView reports "TestScan_format.png: Unrecognised file format"
scanimage trap -> 679ac584-0050_02-SCANIMAGE-exceptq.txt
*Unable to scan successfully using --format=png option

The other 2 scanimage output file types, pnm and tiff, seem to work OK.

I also found that every scan, whether successful or not, produces a *-SCANIMAGE-exceptq.txt file. They all seem to show
Exception C0000005 - Access Violation

Should I post a/some of these exceptq files?/email a report to Silvan?


Regards

Pete




Title: Re: PMInSANE :-P
Post by: Pete on February 03, 2025, 08:26:30 pm
Hi All

Had a response from Silvan suggesting the use of scanimage parameter "--output-file=Filename" instead of using redirection "> Filename" and that seems to work fine here to produce "genuine" PNG and JPEG file types - and the files are not corrupted in any way.


Regards

Pete