Git Product home page Git Product logo

wallpaperchanger's Introduction

WallpaperChanger

WallpaperChanger is a command line utility for changing the wallpaper (desktop background) in Windows.

The intent of this program is not to be a standalone wallpaper program (it is too cumbersome to use for that). It is intended to be used as a “helper” utility program for another program or script.

This utility works fine with Windows XP, Vista, 7, 8, and 10.

The compiled program is available on the Releases page: https://github.com/philhansen/WallpaperChanger/releases

Leave comments or questions on this blog post: http://sg20.com/techblog/2011/06/23/wallpaper-changer-command-line-utility

Use

The program takes two arguments: the file (including path) to use as wallpaper, and the style (Tiled, Centered, Stretched, Fit, Fill). Instead of a file, a directory can also be specified in which case a random image from the directory will be set as the wallpaper. Syntax is: [file|directory] [style] [location]

  [file] is the complete path to the file
  [directory] is the complete path to a directory containing image files
    a random image from the directory will be set as the background
  [style] is an integer (if no style is specified it defaults to Stretched):
    0 for Tiled
    1 for Centered
    2 for Stretched
    3 for Fit (Windows 7 or later)
    4 for Fill (Windows 7 or later)
  [location] is the complete path to a directory for storing the generated file
    defaults to the temp folder which should be fine in most cases

If the style argument is not specified it will default to Stretched.

Optional flags:

  • -h, -help - Display the usage help
  • -r, -remove - Remove the current wallpaper
  • -m, monitor - Set the image on the specified monitor (0 indexed)

When using the monitor option, the full syntax is: -m <index> <file|directory> <location> The style does not need to be specified since it appears to always default to Stretched. Note this functionality is only available on Windows 8 or higher.

Alternatively a config file can be placed in the same directory as the WallpaperChanger executable. The file should be named 'config' without any file extension. Each line in the file should have the full path to an image and can optionally include the monitor index or the style code to use. If the style is not specified it will default to Stretched.

When setting the monitor index in the config file the format of the line should be: <file> -m <index>

The file type can be any of the standard picture types (png, bmp, jpg, gif, etc.). The program will automatically convert the file to a png/bmp file and place it within the users temp directory. Storing the png/bmp file in the temp directory should be fine in most cases, however if you would prefer to use an alternative directory you can specify it as parameter number 3. On Windows 8 or higher it will use a png file for better quality. It seems Windows 7 and lower cannot use a png file directly so a bmp file is used instead. Note: On Windows 7 (and lower) if you are using extremely high resolution images then you may run into the "artifact" problem after Windows sets the file as the background. If you notice artifacts then my recommendation is to use a separate program to lower the resolution of the original image or try saving it as a different file type first (e.g. jpg).

When using the config file it should be formatted like this:

C:\wallpaper1.jpg
C:\wallpaper\wallpaper2.jpg 3
D:\wallpaper3.png 2
"D:\wallpapers to use\image1.jpg"
C:\wallpaper4.jpg -m 1
etc.

Full paths to the image files should be used and if the path or filename contains spaces you will need to wrap it in quotes.

The program has a return code – 0 for normal, 1 for error

An error code will be returned if the program had an exception, for example invalid syntax, invalid file name, invalid style type, etc.

Building the Program

I currently build the program using Microsoft Visual Studio 2017 Community edition. It targets the .NET Framework v2.0 as that is all it requires.

What’s New

  • 1.8 - Config file now supports the monitor index flag to set the wallpaper for a specific monitor (Windows 8 or higher)
  • 1.7 - Added ability to set the wallpaper for a specific monitor (Windows 8 or higher)
  • 1.6 - Use png file for Windows 8 or higher, otherwise use bmp file
  • 1.5 - Wallpaper is now converted to png instead of bmp to avoid artifacts
  • 1.4 – Added remove flag and config file support
  • 1.3 – Added two new styles for Windows 7 or later (Fit and Fill)

wallpaperchanger's People

Contributors

philhansen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wallpaperchanger's Issues

Suggestion of improvement

Your app is very useful.
I continued your work a little bit to got some better error handling and show the original image display name as theme when open explorer.exe shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}.
Maybe you'd like to take a look at it and publish it by yourself (I didn't changed any runtime packages or other dependendies - compiled with VS 2017 and verified working on Windows XP/7)
WallpaperChanger-master_1.9.zip

Since this isn't about an issue, you can close it immedtiately (or I can do).

[Request] Multi monitor options

Would it be possible for you to implement something so users could set what monitor they would like to change wallpaper allowing for setups with both landscape and portrait monitors to be able to have wallpapers that fit and change.

Image quality issues

My image is png. When setting as centered, the actual wallpaper gets noticable JPEG artifacts, even though the generated bmp file is free of them. It seems to be a minor issue of Windows 7/8 families at least.

A possible solution would be to convert images to png instead of bmp.

Random isn't reliable

Hi,

i'm trying to use your utilitie to select randomly a wallpaper from a folder, but each time it's the same wallpaper.

any idea ?

Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.