Created a scrolling desktop background, it's pretty.
I'm just gonna note down here how I did it for future reference:
Scaled the image down to have height 1080, width happened to be 3834.
Made 480 images of original cropped to 1920x1080, each one 4 pixels right of the previous, named Backgroundn, where n=[0..478]; and Background479, a crop to include the right most column of pixels. (3834+1-1920=1915, floor(1915/4)=478).
To do this, I opened the command prompt as: cmd /V
And executed the following:
set a=0
for /l %i in (0,1,478) do (convert Background.bmp -crop 1920x1080+!a!+0 BMP2:Background%i & set /a a+=4)
convert Background.bmp -crop 1920x1080+1915+0 BMP2:Background479
That's ImageMagick's convert, Background.bmp is the 3834x1080 image, the argument for -crop is WxH+X+Y, where W and H are width and height, X and Y are offsets into the original. %i is the loop variable, and is used to name the files. !a! is an environment variable: a=4*%i, used as the X-offset, this is what the /V is needed for. BMP2 prefixes the output filename as Windows needs an old BMP header to work (that took me a while to figure out).
Then I have a C++ program using the Win32 API run in the background to repeatedly change the wallpaper, at most, every 0.2 seconds:
dl.dropboxuser...
Unfortunately, this program is quite resource intensive...
7 сен 2024