Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # b_image_line_tracing_to_text.py
- from PIL import Image, ImageTk
- from tkFileDialog import askopenfilename
- img_data = askopenfilename(filetypes=[('png files', '.png')]) # needs to be placed after pack()
- image = Image.open(img_data)
- w,h = image.size
- img = Image.new('RGB', (w,h))
- rgb = image.convert("RGB")
- sss = list(rgb.getdata())
- xxx = sss[:]
- d = list(set(sss))
- d.sort()
- print d
- L = len(xxx)
- while xxx:
- x,xxx = xxx[:w],xxx[w:]
- try:
- i = x.index((255, 255, 255))
- print i,
- except:
- print w,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement