January 01, 2021

Scanner GUI with NodeRed

In a former post I installed CUPS printer software for a Cannon printer. The scanning functionality is supported by the package SANE. But there is no nice GUI for the scanning function so I made one, with NodeRed(NR), which I really think is "wife" enabled.



If you are new to NodeRed here is a post to start with.

The first thing you have to check, with CUPS installed(including SANE), are which options the scanner accepts. It's done with the command 

$ sudo scanimage --help

Among others, one respons was regarding resolution

--resolution auto||75|150|300|600|1200dpi [75]

another was mode

--mode auto|Color|Gray|Lineart [Color]


which values I want to be able to change via the scanner GUI.

Lineart was a new scan function to me and very nice for drawings, since there is no greyscale, just black/white.

The NR flow starts with setting my defaults, via the function node "Default scan settings", as flow context data
  • Resolution     300 Dpi
  • Mode             Auto
The function node "Issue scan command" builds the command for the "Exec" node. To get unique file names I'm using the time but substitute the colons, ":", to a dash, "-", due too that in the Apple world colons are not allowed in filenames.

During the scan process the scan button goes red with a wait message and if somethings goes wrong with the scan command you will get an popup message.


The template node, the actual scan button, took some Googling to create....

<style>
.button {
height: 100%;
border-radius: 35px;
font-size: 28px;
font-weight: bold;
border-color: white;
border-style: solid;
border-width:10px;
}
</style>
<md-button
class="button"
style="{{'background-color:'+ msg.background}}"
ng-click="send({payload: 'scan'})">
<div ng-bind-html= "msg.topic"></div>
</md-button>

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !