2021-06-17 19:50:16 -07:00
|
|
|
import json
|
|
|
|
import threading
|
|
|
|
import os
|
2021-06-19 13:17:02 -07:00
|
|
|
import subprocess
|
|
|
|
|
2021-07-19 12:09:42 -07:00
|
|
|
def get_img():
|
2021-06-17 19:50:16 -07:00
|
|
|
bmp_path = backend.get_img()
|
|
|
|
|
2021-07-19 12:09:42 -07:00
|
|
|
subprocess.run(['convert', bmp_path, '-define', 'webp:lossless=true', 'img.webp',])
|
2021-06-17 19:50:16 -07:00
|
|
|
|
|
|
|
os.unlink(bmp_path)
|
|
|
|
|
2021-07-19 12:09:42 -07:00
|
|
|
return 'img.webp'
|
2021-06-17 19:50:16 -07:00
|
|
|
|
|
|
|
def touch(x, y, w, is_long):
|
|
|
|
x = round(800 * x / w)
|
|
|
|
y = round(800 * y / w)
|
|
|
|
backend.touch(x, y, is_long)
|