I was having a mare trying to get scanning working on my USB HP Deskjet 2050.
Even though some of these settings are listed as defaults, it produces rubbish.
So I thought that I would document a working command!
Obviously you need to install the scan utilites
matt@server:~$ sudo apt install sane
Then list the devices:
matt@server:~$ scanimage -L device `hpaio:/usb/Deskjet_2050_J510_series?serial=XXXXXXXXXX' is a Hewlett-Packard Deskjet_2050_J510_series all-in-one
And use the output from above to specify the device:
scanimage -d "hpaio:/usb/Deskjet_2050_J510_series?serial=XXXXXXXXXX" --mode Color --resolution 200 --brightness 1000 --contrast 1000 -o scan9.jpg