site  contact  subhomenews

Widescreen wallpaper truncated horizontally for non-widescreen

February 15, 2022 — BarryK

This has been a bug forever, in EasyOS, Quirky and all the pups. The wallpaper is (usually) in /usr/share/backgrounds. Around mid-2000's, wide-screen displays started to appear, whereas most Linux and Windows wallpaper had proportions suited to conventional non-widescreen proportions, such as 1024x768.

So that wallpapers would display undistorted on a widescreen, in 2009 I wrote /usr/sbin/background_reshape, that truncated the image, cutting equal amounts off top and bottom, creating a wide-screen image to suit the screen.

Various people worked on that script, to improve the maths, including old-forum members 'Karl Godt' and 'wjaguar'. Those guys seem to be long gone, but I would like to acknowledge their contribution.

A fundamental problem with the original 'background_reshape' is that it modified the image file in-place, permanently changing the file in /usr/share/backgrounds. Not good if you change the screen proportions, perhaps if change the monitor. To fix that, the script was modified, the original image was stored in folder /usr/share/backgrounds_original. Looking at Puppy woof-CE 'master' branch to refresh my memory:

https://github.com/puppylinux-woof-CE/woof-CE/blob/master/woof-code/rootfs-skeleton/usr/sbin/background_reshape

Hmmm, while looking at woof-CE, I see that 'background_reshape' has been removed from 'testing' branch. So there is no fix, images may display distorted on the monitor. I see that if JWM is used to render the wallpaper, the "image" mode is used, hard-coded, which stretches the image to fit the screen.

Well, that's their decision.

In Quirky, I wasn't happy with that mechanism of keeping the originals in /usr/share/backgrounds_original. Instead, created sub-directories under /usr/share/backgrounds, each sub-directory named for the screen ratio. For example, my current monitor is 1920x1080, which is a ratio of 1.77, so the images for my monitor are kept in folder /usr/share/backgrounds/177.

This is a simple mechanism. /usr/sbin/background_reshape is run from /root/.xinitrc every time X starts, and the script checks if the current wallpaper is in /usr/share/backgrounds/177, if not truncates the original image appropriately and stores it in the '177' folder, and uses that as the wallpaper.

This is great, as Quirky (and easy) on a USB-stick can booted on any computer and the wallpaper is automatically truncated to render undistorted on the screen. Or, if you change the monitor on the same computer.

Now onto the new news...

As I mentioned above, written back in 2009, 'background_reshape' only truncated top and bottom off an image. Today however, we have a reverse situation -- most wallpaper is widescreen, so is going be be very squashed if rendered on a non-widescreen monitor, such as 1024x768.

We have had this problem right to the present day. Finally, I have fixed it. Now, 'background_reshape' will truncate the sides, equally on both sides, of a widescreen image to display undistorted on a non-widescreen monitor.

The original behaviour, truncating a non-widescreen image to fit a widescreen monitor, is still there if required. The decision, whether to cut top & bottom or the sides, is automatically detected.

Yippee!   

Tags: easy