Author Topic: PMInSANE :-P  (Read 3060 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1393
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #15 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.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1393
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #16 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:

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???

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 296
  • Karma: +6/-0
    • View Profile
Re: PMInSANE :-P
« Reply #17 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.
« Last Edit: December 26, 2024, 12:14:56 pm by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 296
  • Karma: +6/-0
    • View Profile
Re: PMInSANE :-P
« Reply #18 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:

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.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1393
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #19 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.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1393
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #20 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.

Roderick Klein

  • Hero Member
  • *****
  • Posts: 711
  • Karma: +14/-0
    • View Profile
Re: PMInSANE :-P
« Reply #21 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

Pete

  • Hero Member
  • *****
  • Posts: 1362
  • Karma: +12/-0
    • View Profile
Re: PMInSANE :-P
« Reply #22 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

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 296
  • Karma: +6/-0
    • View Profile
Re: PMInSANE :-P
« Reply #23 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!
« Last Edit: December 28, 2024, 11:44:41 am by Jan-Erik Lärka »

David McKenna

  • Hero Member
  • *****
  • Posts: 848
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #24 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,

Remy

  • Hero Member
  • *****
  • Posts: 791
  • Karma: +12/-1
    • View Profile
Re: PMInSANE :-P
« Reply #25 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

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1393
  • Karma: +27/-0
    • View Profile
Re: PMInSANE :-P
« Reply #26 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.