Solved

Convert JPG to BMP for Wallpaper

Posted on 2006-10-21
5
3,769 Views
Last Modified: 2011-08-18
This issue seems to have been addressed before in numerous round-about ways, but nothing for this specific problem. Here's what I need to do:

I have a folder of 100 JPG files that I need to randomly set as the Windows XP's desktop wallpaper. The change is done through an automated batch file I created - and it's to be used on several systems. I have the code for the random choosing of the JPG - it's the implementation of the wallpaper that I'm having trouble with. Through a "reg" command in the batch file I can use this registry key:
[HKEY_CURRENT_USER\Control Panel\Desktop]  "Wallpaper"
for telling Windows to use the randomly-chosen picture file. Works great, but it only accepts BMP files, and of course my files are all JPGs. In fact, when the registry setting is adjusted through use of Control Panel->Display->Desktop, Windows XP itself converts the JPG to a BMP before adding it to this registry setting. I need to mimic what Windows does, and implement it through use of a batch file, or a set of commands/programs called from the batch file. It has to be automated and work in any XP system I use it.

(1) Either I need an command-line method to convert my JPG to BMP like Windows does
-or-
(2) I need another method for displaying my JPGs as wallpaper directly

My project will go on a CD, be poped it in to a computer, and it will change the wallpaper with near-total automation (besides starting the batch file).

The Restrictions:
I don't want to convert all my JPGs to BMPs (that would be a waste of space).
I don't want to enable Active Desktop as has been suggested elsewhere (waste of resources in my opinion).
I can't install any programs to accomplish this. The environment needs to be untouched. (vbscript, batch, or stand-alone programs ok).
I prefer free programs. :-)

Help appreciated.
0
Comment
Question by:bsautter33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 17779774
Pardon me isn't that Windows allow other picture format like JPEG to be as wallpaper? I thought JPEG image size generally is smaller than a BMP image?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 17781422
Interesting... apparently the Control Panel copies the JPG file into the user-specific directory and converts it to a BMP file (named Wallpaper1.bmp)

I'll look into a simple batch-file-oriented way to do the conversion, but first tell me:
After replacing the file, how do you get Windows to refresh?  When I change the file, the old wallpaper stays on screen.

-- Dan
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 350 total points
ID: 17782047
Here's a command-line conversion tool
   ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpeg6b32.zip
found on this google groups page:

    http://groups.google.com/group/comp.archives.msdos.announce/browse_thread/thread/295953ef7c81a0f4/50a1cd14eac2f363

Unzip djpeg.exe (it requires no external DLLs other than standard Windows stuff) and use a command line like

    djpeg -bmp somefile.jpg

To output directly to a target directory, use a syntax like:
     djpeg -outfile "c:\some dir\somefile.bmp" somefile.jpg

-- Dan
0
 
LVL 3

Author Comment

by:bsautter33
ID: 17782841
Bravo! That's exactly what I'm looking for.

Allow me to answer your question in return. Updating the wallpaper is done by a relatively simple command:
 
  %windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

Basically, it refreshes the user's settings (wallpaper in this case) without having to logout/in. I tried it on my laptop a few mins ago, and it worked without a hitch. A gem of a command that I had to pull out of a vbscript I had found on the web. My particular situation didn't have need of it, since my batch file reboots at the conclusion of processing, but it'll come in quite handy for other things.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 17790611
Thanks for the points and the grade... and thanks for the tip about UpdatePerUserSystemParameters :-)
-- Dan
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question