0

(I understand the answer might be Windows exclusive).

Is it possible to access the wallpaper image (pixel data) (if any is used) with Python? I've seen some apps do it for some cool effects like custom fading from the "fake wallpaper" to a video game.

I'm writing a 3d screensaver and want to have the actual wallpaper (if any used) as background.

  • I think the path to the current wallpaper is stored somewhere in the registry. – Eric Y Jun 28 '13 at 15:32
  • That's a good hint. Although you can delete the image you've assigned as wallpaper and it's still there in Win7... I guess it's copied somewhere? –  Jun 28 '13 at 15:33
  • I'm more of a Linux person so I'm not entirely sure about this. I think Windows stores the wallpaper image in memory based on the file pointed to in the registry. It refreshes what the desktop shows when it is asked to, such as logging in or changing the wallpaper from the UI. – Eric Y Jun 28 '13 at 15:42
  • 1
    After a little searching, I found this. Maybe it can help http://stackoverflow.com/questions/4321915/is-there-a-windows-registry-entry-for-the-original-background-location – Eric Y Jun 28 '13 at 15:45
  • That's the location! Good one. Now, I think it will be easier to get the current user's name and browse to the file, instead of using registry (that post also suggests using registry will not work perfectly). Now then, how to get the current user's name? –  Jun 28 '13 at 15:49
  • import getpass getpass.getuser() Go ahead and ait this as an answer. Now I'm only worried that the User folders can be costumized and that will break it. Can that be done? –  Jun 28 '13 at 15:57

1 Answers1

0

The wallpaper can be found in the Windows registry under "CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\WallpaperSource". More information about how that works can be found at Is there a windows registry entry for the original background location?.

Getting the username can be done with getpass.getuser().

I don't how customizable the path to the internal copy of the wallpaper is. There is probably an environment variable for the root of it, then you can just append on the wallpaper specific stuff.

Community
  • 1
  • 1
Eric Y
  • 1,677
  • 1
  • 12
  • 17