Update 'cutting.py'

remotes/1710285950382640324/master
suzan 2 years ago
parent bf525f4fc2
commit 110f699324

@ -1,9 +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 = "scanimage --resolution 300 --mode gray --format png > image.png"
#os.system(scanning) os.system(scanning)
#os.system("convert -contrast image.png output.png") os.system("convert -contrast image.png output.png")
#os.system("tesseract output.png image -l eng") os.system("tesseract output.png image -l eng")
fantasyname = open("image.txt" , "r") fantasyname = open("image.txt" , "r")
fantasyname = fantasyname.readlines() fantasyname = fantasyname.readlines()
text = open("image.txt", "r").read() text = open("image.txt", "r").read()
@ -11,7 +16,8 @@ text = text.replace(b'\xe2\x80\x98'.decode(), "'")
text = text.replace(b'\xe2\x80\x99'.decode(), "'") text = text.replace(b'\xe2\x80\x99'.decode(), "'")
text = text.replace(b'\xe2\x80\x9d'.decode(), "'") text = text.replace(b'\xe2\x80\x9d'.decode(), "'")
text = text.replace(b'\xe2\x80\x9c'.decode(), "'") text = text.replace(b'\xe2\x80\x9c'.decode(), "'")
#-------------------------------------------------------------
#printing
print(text) print(text)
print("------") print("------")
lines = text.split("\n") lines = text.split("\n")
@ -24,4 +30,14 @@ for line in lines:
#if l!="" or l != ['\n', '\r\n']: #if l!="" or l != ['\n', '\r\n']:
#print(l) #print(l)
#os.system("echo '"+l+"' > /dev/usb/lp0") #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