Up until a couple months ago, if I changed my wallpaper/background image, I could choose between tile, zoom, centre, scale, fill or span. These options no longer appear in GUI for changing the background image.
I am using Ubuntu 17.10.
Ubuntu – Why are the wallpaper settings, tile, zoom, center, scale, fill or span options no longer available
backgroundgnome-shellwallpaper
Related Solutions
To understand the intricacies of the various options available, its worth just having a little dig around in the source-code to see what happens with each option. I'll try my best to put this is simply as possible, but with the caveat - you need to enjoy a bit of mathematics!
Lets grab the source-code:
apt-get source gnome-desktop3
cd gnome-desktop*
cd libgnome-desktop
Now open the following source-module with your favourite text editor:
gedit gnome-bg.c
There are two key functions to examine:
get_scaled_pixbuf
switch (placement) { case G_DESKTOP_BACKGROUND_STYLE_SPANNED: new = pixbuf_scale_to_fit (pixbuf, width, height); break; case G_DESKTOP_BACKGROUND_STYLE_ZOOM: new = pixbuf_scale_to_min (pixbuf, width, height); break; case G_DESKTOP_BACKGROUND_STYLE_STRETCHED: new = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); break; case G_DESKTOP_BACKGROUND_STYLE_SCALED: new = pixbuf_scale_to_fit (pixbuf, width, height); break; case G_DESKTOP_BACKGROUND_STYLE_CENTERED: case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER: default: new = pixbuf_clip_to_fit (pixbuf, width, height); break; }
and the function:
draw_image_area
switch (bg->placement) { case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER: pixbuf_tile (scaled, dest); break; case G_DESKTOP_BACKGROUND_STYLE_ZOOM: case G_DESKTOP_BACKGROUND_STYLE_CENTERED: case G_DESKTOP_BACKGROUND_STYLE_STRETCHED: case G_DESKTOP_BACKGROUND_STYLE_SCALED: pixbuf_blend (scaled, dest, 0, 0, w, h, x + area->x, y + area->y, 1.0); break; case G_DESKTOP_BACKGROUND_STYLE_SPANNED: pixbuf_blend (scaled, dest, 0, 0, w, h, x, y, 1.0); break; default: g_assert_not_reached (); break; }
- Lets first look at the option SPAN
This is described by the case option G_DESKTOP_BACKGROUND_STYLE_SPANNED
The wallpaper (pixbuf) is first scaled to the area to be filled (pixbuf_scale_to_fit) i.e. take the original wallpaper and expand its width and height to match the area.
It uses the following algorithm to expand:
factor = MIN (max_width / src_width, max_height / src_height); new_width = floor (src_width * factor + 0.5); new_height = floor (src_height * factor + 0.5);
src_ is the wallpaper dimension width or height, whereas max_ is the area dimension width or height
Quite a complicated algorithm as you can see, but basically it tries to see what is the minimum dimension that needs to be expanded before scaling both dimensions linearly by the same factor it has calculated.
This area is the combined area of your monitor or monitors.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the whole area.
- Lets look at the option SCALE
This is described by the case option G_DESKTOP_BACKGROUND_STYLE_SCALED
As you can see in the source code, its very similar to SPAN. It uses the same algorithm to scale the picture as SPAN.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
- Lets look at the option Zoom
This is described by the case option G_DESKTOP_BACKGROUND_ZOOM
The wallpaper (pixbuf) is first scaled to the area to be filled (pixbuf_scale_to_min) i.e. take the original wallpaper and expand its width and height to match the area.
It uses the following algorithm to expand:
factor = MAX (min_width / src_width, min_height / src_height); new_width = floor (src_width * factor + 0.5); new_height = floor (src_height * factor + 0.5);
src_ is the wallpaper dimension width or height, whereas max_ is the area dimension width or height*
Notice the subtle difference than the previous two options - it calculates the maximum dimension that needs to be expanded before scaling both dimensions linearly by the same factor it has calculated.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
- Lets look at the option STRETCH
This is described by the case option G_DESKTOP_BACKGROUND_STRETCHED
The wallpaper (pixbuf) is expanded both width-wise and height-wise to the area - thus you can get a distortion if your wallpaper is not the exact dimensions of the wallpaper
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually.
- Lets look at the option CENTER
This is described by the case option G_DESKTOP_BACKGROUND_CENTRED
The wallpaper (pixbuf) is actually clipped to size if its too large to fit the area i.e. the the width is reduced to the area width and the height is reduced to the area height.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually. The resulting image is then drawn into the center of the overall area of the monitor.
- Lets look at the option TILE
This is described by the case option G_DESKTOP_BACKGROUND_WALLPAPER
The wallpaper (pixbuf) is similarly clipped as the Center option.
The resulting wallpaper (pixbuf) is then blended with the desktop background colour for the view port area i.e. not the combined area of all monitors, but the area of each monitor individually. The resulting image is copied repeatedly starting in one corner filling the overall area with each image i.e. tiled width-wise and height-wise.
If your purpose is to display the current earth view, you might make use of xplanet, which gets a more frequently updated image.
Install xplanet with -
sudo apt-get install xplanet
Then, in your script replace the image source with the xplanet output as below.
xplanet -body earth -num_times 1 -projection mercator -output $wallpaper_name -geometry 1366x768
(replace geometry parameter value with your screen size).
Now, you will get a more frequently updated image that won't be sliced.
Best Answer
These options are removed from the default GUI wallpaper settings (accessible from the Settings application) in the recent versions of GNOME 3 for some reason.
As an alternative, you may use another GUI application called (GNOME) Tweaks to get those extra options. To install it first run
Then launch Tweaks and go to the 'Appearance' section on Ubuntu 18.04 and later (or the 'Desktop' section on Ubuntu 17.10). You'll get options to adjust the background and lock screen images.