-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No composite images #1
Comments
Yes. This project has just been launched so there might be lack of features. I'm considering adding these features. Now just consider it a proof of concept of fast blur and PNG encoding. I'll elaborate other things soon. |
I like it so far, significantly faster than using Good work 👍 |
Well you don't need C in this case because there are very fast python image processing librarys (with C extensions). import subprocess
import os
import mss
import sys
from PIL import Image
from screeninfo import get_monitors
monitors = get_monitors()
with mss.mss() as sct:
root_w = sum(map(lambda x: x.width, monitors))
root_h = max(map(lambda x: x.height, monitors))
# take screenshot
monitor = {"top": 0, "left": 0, "width": root_w, "height": root_h}
sct_img = sct.grab(monitor)
img = Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX")
# pixelate
imgSmall = img.resize(
(int(img.size[0] / 10), int(img.size[1] / 10)), resample=Image.BILINEAR
)
result = imgSmall.resize(img.size, Image.NEAREST)
icon = Image.open(sys.argv[1])
# calc lock icon position on primary display
primary = monitors[0]
area = (
int(((primary.width / 2) + primary.x) - icon.size[0] / 2),
int(((primary.height / 2) + primary.y) - icon.size[1] / 2),
)
# add lock icon to bg image
result.paste(icon, area, icon)
subprocess.run(
[
"i3lock",
"--raw",
str(result.width) + "x" + str(result.height) + ":rgb",
"-i",
"/dev/stdin",
],
stdout=subprocess.PIPE,
input=result.tobytes(),
)
This scripts executes in 0.238 sec on my T480s notebook with 3 external monitors. (prior to the i3lock call) |
There is no feature for adding images to compose with the screenshot. Also lacks other features from original i3lock-fancy.
The text was updated successfully, but these errors were encountered: