4

When setting a wallpaper you can choose from tile, zoom, center, scale, fill or span options. What do they mean?

How scale option is different from zoom and span? I can't see the difference on any of my wallpapers.

3 Answers 3

6
+500

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.

3
  • Thanks for this answer. In the Zoom option it says min_width, min_height and not max_* as you say below. Is this because it refers to individual monitors?
    – hytromo
    Aug 6, 2013 at 9:03
  • @hakermania - pop into the general chatroom to discuss.
    – fossfreedom
    Aug 6, 2013 at 10:17
  • Thanks a lot :) Wallch is better with this feature now :) i.imgur.com/nu3VzAu.png
    – hytromo
    Aug 8, 2013 at 21:06
5

This is going to be tricky to see but...

  • Tile - tiles an image, like tiles on a floor, try a really small images, like 100x100. see for examples
  • Zoom - Zooms on an image so that the largest dimension is now the largest dimension of the desktop. For example a 200x100 image on a 800x600 desktop would be zoomed to 800x400, leaving 200px of empty space.
  • Fill - basically "scales" to the width of your monitor. Ignoring height. so if you have a 1000x1000 resolution and a 600x500 image, the image will be scaled to 1200x1000 and centered cutting off the top and bottom a bit.
  • Span - is like Scale but across multiple monitors. So if you have 2 800x600s and a 1600x600 image you can "span" it across both monitors
  • Center - is for undersized images (though larger one works) that place the image in the center of a single monitor.
  • Scale - "resizes" the image. Making it exactly the same size as your desktop. So a 800x600 desktop will 'scale' a 900x200 image to exactly 800x600, and distortion be damned.

Sorry I can't provide samples other then tile, but the images depend strongly on your monitor. You should be able to easily see the options in effect if you use a seriously undersized and bad aspect ration image to test with.

2
  • I believe fill and zoom descriptions are swapped with each other.
    – seler
    Dec 8, 2012 at 16:44
  • could be not sure. Guess we need more feedback
    – coteyr
    Dec 8, 2012 at 20:23
3

From my observations on multiple images :

  • Center : places the image at the centre of the desktop, keeping its original size.
  • Tile : tiles the image, like tiles on a floor, keeping the image original size.
  • Fill : stretches (or reduces) the image to match the screen, but does not care about keeping proportions.
  • Zoom : stretches (or reduces) the image, keeping proportions, so as the background is completely filled. When the image and the screen have different proportions it will cut off the extra bands that cannot be fitted (top and bottom or left and right depending on the image).
  • Scale : also stretches (or reduces) the image, keeping proportions, but makes sure the image fully fits in the screen area. When the image and the screen have different proportions it will thus allow empty bands on the sides (again, top and bottom or left and right depending on the image).
  • Span : no idea. Seems like Scale. I suppose Coteyr has it right, and that it does the same as Scale but for multiple screens.
1
  • This is by far the best explanation. Simple and clear to understand. Just hope it's also accurate :)
    – MestreLion
    Aug 17, 2014 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .