How to set Windows Lockscreen images as desktop backgrounds

How to set Windows Lockscreen images as desktop backgrounds

Windows stores it’s “Windows Spotlight” images in C:\Users\<username>\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_<random_chars>\LocalState\Assets (replace <username> and <random_chars>).

I wrote a PowerShell script to copy those images (which are gorgeous to the point I actually stop and admire them on the lockscreen before entering my pin) to your Pictures folder where they can be picked up by a regular Slideshow desktop background.

Just save this script and set up a Task in Task Scheduler to execute this script once a day or so. Then go your personalisation settings in Windows 10 and make your Desktop background a slide show pointing to the folder specified in the $dest variable.

$source="C:\Users\danie\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
$dest="C:\Users\danie\Pictures\Spotlight_Wallpapers"

# Copy to temp directory for processing (ignore files under 1MB)
robocopy $source $dest/temp /MIN:1000000 /NJH /NS /NJS
pushd $dest/temp
Dir | Rename-Item -NewName { [io.path]::ChangeExtension("wallpaper_" + $_.name, "jpg") }

[void][reflection.assembly]::loadwithpartialname("system.drawing");

# Remove any ugly portrait versions of wallpapers
$(Get-ChildItem -Filter *.jpg).FullName | ForEach-Object {
  $img = [Drawing.Image]::FromFile($_);
	$width = $img.Width
	$height = $img.Height

	$img.Dispose()

	If ($height -gt $width) {
		echo "Deleting portait image ($($width)x$($height)): $($_)"
		Remove-Item $_
	}
}

# copy renamed files to final $dest
robocopy $dest/temp $dest /MOV /XX

# Clear out temp directory
Dir | ForEach-Object {
	If ($_) {
		echo "Removing $($_)"

		Remove-Item $_
	}
}
popd

The script ignores files smaller than 1MB and automatically removes weird portrait versions windows creates (presumably for portrait tablet mode).