0

I just looked at this answer How to discover which image file is the current desktop background on Windows?

And it doesn't answer for windows 10, specifically if the user has chosen a slideshow. How do I determine what's going on?

In Win10 bash would be great, but powershell or C# would work too.

Community
  • 1
  • 1
McKay
  • 12,334
  • 7
  • 53
  • 76
  • 1
    Use the IDesktopWallpaper interface. It handles the case where the user put a different wallpaper on each monitor. – Raymond Chen Jul 24 '16 at 03:34

2 Answers2

2

You should be able to get the slideshow images by using the Windows API. There's a Windows Shell interface called IDesktopWallpaper that has a GetSlideshow method.

GetSlideshow

Gets the images that are being displayed in the desktop wallpaper slideshow.

If you're using for example C#, it's relatively easy to call this method from managed code using P/Invoke.

Community
  • 1
  • 1
Timo Salomäki
  • 7,099
  • 3
  • 25
  • 40
-1

Technically, windows background image is always saved to the following directory:

'C:/Users/(Username)/AppData/Roaming/Microsoft/Windows/Themes/CachedFiles/CachedImage_1366_768_POS4.jpg'

If you are using python you can use the os module to get your pc's username by:

import os
print(os.getlogin())

With it in hand you can then open the background image using:

import os
from PIL import Image
dgpath= f'C:/Users/{os.getlogin()}/AppData/Roaming/Microsoft/Windows/Themes/CachedFiles/CachedImage_1366_768_POS4.jpg'
im = Image.open(dgpath) 
im.show() 
tripleee
  • 175,061
  • 34
  • 275
  • 318
  • While this may work under some circumstances, this doesn't appear to work in the case of some slideshows. I do not have a `CachedFiles` folder in my `Themes` folder. – McKay Oct 14 '22 at 19:05