Compare commits
5 Commits
b2c112a728
...
75a7d0486c
Author | SHA1 | Date | |
---|---|---|---|
|
75a7d0486c | ||
|
56440d1235 | ||
|
159ab0c484 | ||
|
853968a447 | ||
|
4a197cc248 |
@ -8,6 +8,8 @@ import pyautogui
|
||||
# Define the directory where screenshots will be saved
|
||||
output_dir = os.path.expanduser("~/.screenmonitor/output")
|
||||
|
||||
screenshotIntervalInMinutes = 17
|
||||
|
||||
# Ensure the output directory exists
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
@ -19,6 +21,33 @@ def capture_screenshot():
|
||||
# Apply blur
|
||||
blurred_screenshot = screenshot.filter(ImageFilter.GaussianBlur(10))
|
||||
|
||||
# resize
|
||||
width, height = blurred_screenshot.size
|
||||
width, height = width // 5, height // 5
|
||||
blurred_screenshot = blurred_screenshot.resize((width, height), Image.NEAREST)
|
||||
|
||||
# Randomly turn 10% of the pixels grey
|
||||
pixels = blurred_screenshot.load()
|
||||
total_pixels = width * height
|
||||
black_pixels_count = int(total_pixels * 0.1)
|
||||
neighbor_copy_pixels_count = int(total_pixels * 0.01)
|
||||
|
||||
for _ in range(black_pixels_count):
|
||||
x = random.randint(0, width - 1)
|
||||
y = random.randint(0, height - 1)
|
||||
shade = random.randint(0, 255)
|
||||
pixels[x, y] = (shade, shade, shade)
|
||||
|
||||
# Make 1% of the pixels copy themselves to their 8 neighbors
|
||||
for _ in range(neighbor_copy_pixels_count):
|
||||
x = random.randint(0, width - 1)
|
||||
y = random.randint(0, height - 1)
|
||||
original_color = pixels[x, y]
|
||||
for dx in [-1, 0, 1]:
|
||||
for dy in [-1, 0, 1]:
|
||||
if 0 <= x + dx < width and 0 <= y + dy < height:
|
||||
pixels[x + dx, y + dy] = original_color
|
||||
|
||||
# Compress and save
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
filename = os.path.join(output_dir, f"screenshot_{timestamp}.jpeg")
|
||||
@ -43,8 +72,10 @@ def delete_old_screenshots():
|
||||
def main():
|
||||
while True:
|
||||
# Calculate the random time within the next 17-minute interval
|
||||
next_interval_start = datetime.now() + timedelta(minutes=17)
|
||||
random_seconds = random.randint(0, 17 * 60)
|
||||
next_interval_start = datetime.now() + timedelta(
|
||||
seconds=screenshotIntervalInMinutes * 60
|
||||
)
|
||||
random_seconds = random.randint(0, screenshotIntervalInMinutes * 60)
|
||||
random_time = datetime.now() + timedelta(seconds=random_seconds)
|
||||
|
||||
# Sleep until the random time within the interval
|
||||
|
Loading…
Reference in New Issue
Block a user