I played around with few different scanning softwares on Ubuntu, and noticed that it is possible to scan from terminal by issuing quickscan command. By searching more, I found out that the image it creates is in .pnm format. I decided to add converting images from pnm to jpg format in the script.
The script can be found at Github https://github.com/ikoutone/quickscan. You can also copy the file called ’scan’ to /usr/bin/ folder on your linux distribution so you can access the scan command anywhere by just typing ’scan’ in terminal.