My solution to the hp2400 problem on Linux

    Recently I discovered that drivers for the HP ScanJet 2400 scanner for Linux appeared on the network . A year ago, there wasn’t ... So I decided to install it, 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 we need to upload scanned copies to the workflow system, and there is a size limit. You can of course scan in color and then edit in some editor, but IMHO unnecessary movements, and unnecessary for ordinary users.

    And then a little free time appeared and I decided to write a small script to simplify this process. Everything turned out to be outrageously simple. I used scanimage to capture the image, modgrify to modify the image, zenity and notify-send to communicate with the user. At the very beginning, the user selects the directory and file name. Then comes the scanning and transformation of the picture (resizing and converting to shades of gray). At the end, open the scans of the picture in any convenient viewer, I have it kuickshow. It works quickly and copes with the task. And most importantly, I spent my free time on something useful)


    #!/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



    Also popular now: