⬆️ ⬇️

My solution to the problem with hp2400 in Linux

I recently discovered that drivers for the HP ScanJet 2400 under Linux appeared on the network. A year ago there was no ... So I decided to install, but it turned out that only minimal functionality was supported. And unfortunately, scanning in the “grayscale” mode is not supported, only in color. Yes, this is not such a problem, but we have a corporate network and need to upload scan copies to the workflow system, and there is a size limit. You can of course scan in color and then edit it in some kind of editor, but IMHO are superfluous movements, and unnecessary to ordinary users.



And then there was some free time and I decided to write a small script to simplify this process. Everything turned out to be just disgraceful. I used scanimage to capture the image, modgrify to modify the image, zenity, and notify-send to communicate with the user.





#!/bin/bash



DATE=`date +%F-%H-%M-%S`;

NAME=$(zenity --file-selection --save --confirm-overwrite --title=' ' --filename="$DATE".jpg);



if [ "$?" = "1" ]; then

echo "Canceled"; exit;

else

echo "Start scaning. Output filename: $NAME";

notify-send -t 25000 -i /usr/share/icons/crystalsvg/48x48/devices/scanner.png " . : $NAME "

scanimage > "$NAME";

mogrify -resize 40% -colorspace GRAY "$NAME";

echo "Scaning complite";

#zenity --info --text=" . $NAME";

kuickshow $NAME;

fi



')

At the very beginning, the user selects the directory and file name. Then the image is scanned and transformed (resized and translated into shades of gray). In the end, we open the scanned drawing in any convenient viewer, I have this kuickshow. It works quickly and copes with the task. And most importantly spent free time on something useful)

Source: https://habr.com/ru/post/67650/



All Articles