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

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +7/-0
    • View Profile
PMInSANE :-P
« 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)

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2548
  • Karma: +200/-0
    • View Profile
Re: PMInSANE :-P
« Reply #1 on: December 16, 2024, 09:02:46 pm »
Cool!!! I should look at building the latest SANE...

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1440
  • Karma: +28/-0
    • View Profile
Re: PMInSANE :-P
« Reply #2 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?

Pete

  • Hero Member
  • *****
  • Posts: 1417
  • Karma: +15/-0
    • View Profile
Re: PMInSANE :-P
« Reply #3 on: December 17, 2024, 06:36:43 am »

Jan-Erik Lärka

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

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +7/-0
    • View Profile
Re: PMInSANE :-P
« Reply #5 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.
« Last Edit: December 18, 2024, 09:45:20 pm by Jan-Erik Lärka »

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1440
  • Karma: +28/-0
    • View Profile
Re: PMInSANE :-P
« Reply #6 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!

Jan-Erik Lärka

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



Dariusz Piatkowski

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

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1440
  • Karma: +28/-0
    • View Profile
Re: PMInSANE :-P
« Reply #9 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.
« Last Edit: December 19, 2024, 09:49:29 pm by Dariusz Piatkowski »

Remy

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

Jan-Erik Lärka

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

Pete

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


Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 345
  • Karma: +7/-0
    • View Profile
Re: PMInSANE :-P
« Reply #13 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.
« Last Edit: December 25, 2024, 12:04:30 pm by Jan-Erik Lärka »

Jan-Erik Lärka

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