Hi all,
I think this is a brainstorm type of thing - I’ve done some Googling and couldn’t find anything related.
I have a large collection of stuff dumped in my screensaver/wallpaper dir, ranging in size from about 400x400 to about 8000x11000, a scan of an Army topo map. I have Plasma set up to read the appropriate dir’s and it is set to “Scaled, keep proportions”, a nice solid colour backdrop, random order and updating every 15 minutes - all good and works as expected EXCEPT…
I run a pretty standard 1080p display set up so when it is the turn of one of the bigger images to be displayed, they get scaled down and displayed nicely. The mega scan of the Ducati still looks good. On the other hand, when some of the smaller images get their turn, the scaling UP process produced a pixelated blur that has me quickly reaching for the mouse and right-clicking for “Next Wallpaper Image”.
Would it be possible for have another option that will only scale down BUT NOT scale up? I’m fine with a small scan, say 650x500, of an historic map displaying centered but unscaled, it is not off putting like it would be scaled up with everything blurry.
Does this make sense. Scaling down, you keep “clarity” but the scaling up is a killer. Is this something that should be implented? Has it been poh-poh’d[1] in the past? Does anyone have any knowledge as to whether I’ve overlooked a config option to fix this? I’ve been a C/C++ coder for ages and have thought to have a look at Qt so if there is no config and I could be pointed in the right direction I might be inclined to have a bit of a hack.
Andrew
[1] Replace the ‘h’ with an ‘o’ - dodgy spelling because the forum spat the dummy.
Hi - while I don’t know how to programatically do what you’re talking about on-the-fly in Plasma (and that could be valid as a wishlist bug, or as a good project to poke around with yourself as you mentioned), something like the method here using CLI tools to create what you’re looking for in a wallpaper-specific directory might do the trick?
Basically, imagining that as the main “action” command within a bash script you could run through for any files that fit the size criteria you’ve identified, in order to create a file that’s pre-configured to be a good size for your screen resolution?
It is WAYYYYY simpler than that. Having not dug through the code I can’t say categorically this is how it works but it is how I would guess it works, quick pseudocode/C code following…:
void prepImageForWallpaper(image *imageThingy, int screenWidth, int screenHeight)
{
if(imageThingy->width > screenWidth || imageThingy->height > screenHeight)
{
//
// Image is too BIG so need to shrink it
//
scaleDownImage(imageThingy, screenWidth, screenHeight);
}
else if(imageThingy->width < screenWidth || imageThingy->height < screenHeight)
{
//
// Image is too SMALL so need to expand it
//
scaleUpImage(imageThingy, screenWidth, screenHeight);
}
else
{
//
// Goldilocks zone - it's just right. The artist has created a "1080p"
// sized image and the display is 1080p so do nothing
//
}
return;
}
Now, as I don’t want my smaller images “expanded”, just comment out/delete “scaleUpImage()” hence nothing will be done to smaller images. Also, remember that this is just the in memory representation, not the image “on disk”.
Now, let me reiterate, I have not looked at the code so the above is probably totally wrong as to how this works, and also there is a nasi lemak with my name on it waiting for lunch here in Perth, Australia so I’ve just belted this out quickly but hopefully it gets the idea across.
If you are addressing the need for personal use, I would recommend using a custom script to accomplish wallpaper replacement, similar to:
#!/bin/bash
#set -x
export DISPLAY=:0
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id ${USER} -u)/bus
cd $(dirname $0)
setdesktop(){
fpath=$(pwd $1)
fname=$1
script=$(cat <<-EOF
var allDesktops = desktops();
print (allDesktops);
for (i = 0; i < allDesktops.length; i++) {{
d = allDesktops[i];
d.wallpaperPlugin = "org.kde.image";
d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
d.writeConfig("Image", "file://${fpath}/${fname}")
}}
EOF
)
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "${script}"
}
# setdesktop /path/to/image
The advantage of a script is that you can select the image exactly as you want it, and I use this script to download and apply the image from a web source.
WHAT??? I don’t think you have at all understood what I have asked. It is quite simple. If the image is smaller than the dims of the screen, DON’T SCALE IT, just display it as is. Simple. Probably a 5 - 10 line fix in the code. No need for dodgy looking Bash scripts etc.
I don’t think I articulated well what I was talking about / thinking of -
You want images smaller than certain dimensions to appear as wallpaper unstretched, with a solid background filling in the space
There isn’t a (readily apparent, anyway) setting in the desktop environment to scale images only down, not up
I mentioned that you could submit a wishlist bug for KDE Plasma to ask for that feature to be implemented
You could, in the meantime, instead of relying on the desktop environment to scale such images as you wish, create ready-to-use wallpapers in the desired dimensions using a CLI tool that’s part of the ImageMagick package
You could probably even script that step to run through all the desired images
I understand that’s not a replacement for having a scaling feature built in that operates the way you want, I’m merely suggesting a way to get your desired end result using only existing programs in their existing states
I can absolutely see how that would be a desired state for your wallpapers - simply offering a thought of how to go about it in a “low to no code” way if that’s how you’d want to go. This could be a good introduction to the relevant code too, and in my limited experience (working on a small bug in Kate’s shortcut handling), the instructions given for setting up a KDE development environment work well and I was up and running within an hour trying out different approaches