MSLockscreenImageGrabber/MSLockscreenImageGrabber.py

27 lines
989 B
Python
Raw Normal View History

2023-12-06 15:41:56 +00:00
# reiyua, rei@reiyua.lol, 2023
2023-12-06 15:44:00 +00:00
# This is a simple python script which copies the images from the Microsoft Lockscreen Wallpaper Directory in AppData, append them with ".jpg" and place them in a directory of the user's choosing.
2023-12-06 15:41:56 +00:00
2023-12-20 05:24:15 +00:00
# Import modules
2023-12-06 15:39:43 +00:00
import os
import shutil
2023-12-20 05:24:15 +00:00
from PIL import Image
2023-12-06 15:39:43 +00:00
# Set the source and destination directories (Replace \ with / before imputting)
2023-12-20 05:24:15 +00:00
source = 'C:/Users/USER/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets/' #Replace "USER" with your username
destination = '' # Replace with the directory you want to copy the files to, swapping "\" with "/" Example: 'C:/Users/User/Desktop/Wallapapers
dir_list = os.listdir(source)
2023-12-14 07:43:06 +00:00
# Print message stating code has started
print ("Task started, please wait...")
2023-12-06 15:39:43 +00:00
2023-12-14 07:43:06 +00:00
2023-12-20 05:24:15 +00:00
#Main loop
for file in dir_list:
img = Image.open(source+file)
if img.width > img.height: # Image is Landscape and not Portrait
shutil.copyfile(source+file,destination+file+".jpg")
2023-12-06 15:39:43 +00:00
2023-12-14 07:43:06 +00:00
2023-12-14 07:43:06 +00:00