Compare commits

..

5 Commits

Author SHA1 Message Date
PAlexanderFranklin
75a7d0486c Fix comments 2024-08-02 13:55:19 -07:00
PAlexanderFranklin
56440d1235 Add screenshot resizing 2024-08-02 13:49:20 -07:00
PAlexanderFranklin
159ab0c484 Add screenshot interval constant 2024-08-02 13:35:09 -07:00
PAlexanderFranklin
853968a447 change black pixels to a random shade 2024-08-01 21:12:19 -07:00
PAlexanderFranklin
4a197cc248 Add some randomization to further obscure text 2024-08-01 21:04:31 -07:00

View File

@ -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