screenshot-service/get-text-position.py
Kuba Orlik c1a2ff6200 Simple highlight of the set-cookies header.
Next thing to do would be to annotate it with some human-readable
comment ("here personal ID is sent")  and an arrow, and allow to pick
any header
2022-03-06 22:37:08 +01:00

19 lines
405 B
Python
Executable File

#!/usr/bin/python
import sys
import pytesseract
from pytesseract import Output
# from PIL import Image
img = sys.argv[1]
d = pytesseract.image_to_data(img, output_type=Output.DICT)
# print(d)
n_boxes = len(d['level'])
for i in range(n_boxes):
(x, y, w, h, text) = (d['left'][i], d['top'][i], d['width'][i], d['height'][i], d['text'][i])
if text=="":
continue
print(x, y, w, h, text)