Compare commits

..

No commits in common. 'master' and 'master' have entirely different histories.

@ -1,43 +1,14 @@
import os import os
import calendar
import time
#-----------------------------------------
#pruning
print("starting the pruning process") print("starting the pruning process")
scanning = "scanimage --resolution 300 --mode gray --format png > image.png" scanning = "sudo scanimage --resolution 300 --mode color -o image.png"
os.system(scanning) os.system(scanning)
os.system("convert -contrast image.png output.png") os.system("tesseract image.png text.txt -l eng")
os.system("tesseract output.png image -l eng") fantasyname = open("text.txt.txt" , "r")
fantasyname = open("image.txt" , "r")
fantasyname = fantasyname.readlines() fantasyname = fantasyname.readlines()
text = open("image.txt", "r").read() for line in fantasyname:
text = text.replace(b'\xe2\x80\x98'.decode(), "'") line = line.split(" ")
text = text.replace(b'\xe2\x80\x99'.decode(), "'") for l in line:
text = text.replace(b'\xe2\x80\x9d'.decode(), "'") if l!="" or l != ['\n', '\r\n']:
text = text.replace(b'\xe2\x80\x9c'.decode(), "'") print(l)
#------------------------------------------------------------- os.system("echo '"+l+"' > /dev/usb/lp0")
#printing
print(text)
print("------")
lines = text.split("\n")
for line in lines:
dotprint = f'echo "{ line }" > /dev/usb/lp0'
os.system(dotprint)
#for line in fantasyname:
#line = line.split(" ")
#for l in line:
#if l!="" or l != ['\n', '\r\n']:
#print(l)
#os.system("echo '"+l+"' > /dev/usb/lp0")
#-------------------------------------------------------------------
#copying
print("copying the scan")
current_GMT = time.gmtime()
ts = calendar.timegm(current_GMT)
#print(ts)
# First make a folder, for example called "scans"
# Then you can use this to write new filenames
copy_command = f"cp image.png scans/image-{ ts }.png"
os.system(copy_command)

Loading…
Cancel
Save