You are here


  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

Plugin is created as a part of an aura project.

How it works

Plugin takes a single argument - path of an image file - and then performs the following actions:

  • Crop solid or fuzzy-solid margins by creating a mask-layer, adjusting it's brightness/contrast (to eliminate minor noise/texture on margins), using autocrop on it, then cropping the original layer with the same parameters.
  • Check whether aspect ratio or size difference of an image is greater than thresholds, defined in the script, issuing a warning in this case, without setting anything (it'd look horrible anyway!).
  • (optional) Process image metadata (EXIF, XMP, IPTC) using pyexiv2 module, if it's available.
  • Do initial rescaling for larger images, preserving aspect ratio using standard cubic algorithm.
  • Perform a "liquid rescaling" operation (aka "seam carving") to resize image to exact desktop size using liquid rescale plugin.
  • Render metadata label in the corner of an image with the most contrast color with bg-color outline, picked according to the label background area color using CIEDE2000 algorithm if optional colormath module is available, a simplier method otherwise.
  • Set image as a desktop background using either python gconf interface (for gnome), xfconf (xfce) or enlightenment (e17) via dbus interface, falling back to just drawing it to an X root window via pygtk.

Result of these manipulations is a perfectly fitted and labelled desktop background with as little quality loss as possible.


Note that even though images are enlarged and scaled to different aspect, all the image features are preserved from distortion, which occurs in uniformly-colored and (relatively) featureless areas instead.



Optional (good to have, but will work without these) stuff:

Having the required packages available in the system, just put the plugin into one of the gimp plugin directories (like "~/.gimp-2.8/plug-ins/") and set executable bit on it ("chmod +x ~/.gimp-2.8/plug-ins/").

Since techniques, used to determine desktop size and set background is specific to X window system, setting background will not work on windows, but python code can be easily adjusted to use static values and just save the resulting image. I don't have a windows machine to make/test these changes though.


To use the plugin from already-started GIMP instance, use "Filters -> Python-Fu -> LQRify to desktop" menu option.

Non-interactive invocation example:

gimp -ib '(python-fu-lqr-wpset RUN-NONINTERACTIVE "image.jpg") (gimp-quit TRUE)'

(where "image.jpg" is a path to image to use as a background)

Various customization is also possible (although in most cases it should not be necessary) by editing variables, set in the beginning of the script:

max_aspect_diff = 0.7 # 16/9 - 4/3 = 0.444
max_smaller_diff = 3 # don't process images N times smaller by area (w*h)
min_prescale_diff = 0.3 # use cubic on larger images (preserving aspect), then lqr
label_offset = 10, 10
label_colors = [0]*3, [255]*3, (255, 0, 0),\
(0, 255, 0), (0, 0, 255), (255, 255, 0), (0, 255, 255) # most contrast one will be chosen
font_filename = 'URW Palladio L Medium', 16
font_timestamp = 'URW Palladio L Medium', 11
# Asterisk will be replaced by temporary id for created images
# All files matching the pattern will be a subject to cleanup!
result_path = '/tmp/.lqr_wpset_bg.*.png'


Artworks on this page ("D I E" and "AIR IN KYOTO" by Kai Lim) are subject to a copyright and used with author's permission.

Plugin code is released under a permissive WTFPL license, feel free to hack and reuse it as you see fit.

AttachmentSize KB
GIMP Version: 
Code License: 


After installing the plugin in the Gimp plugin directory without .txt and making it executable I cant find it in the Python menu (also not being greyed out).

I am using Ubuntu 10.04, Gimp 2.6.8 , python 2.6.5 v python-gtk2 v2.17 and a working Carlo Baldassi liquid rescale plugin.

Please advice

Tried the plugin. It installed well but when I wanted to use it, there came two error messages (dont know anymore what it was ) After that LQRify doesnt work anymore and stays grayed out in the menu, even after reinstalling the plug in. How to restore this?

It seem to be grayed-out when no image is opened in GIMP, I haven't looked much into an interactive-invocation interface, but I probably will, shouldn't be hard to make it just set current image.
Try using it from the terminal in the meantime - at least it should give you descriptive and copy-paste'able error messages right there.

Subscribe to Comments for "lqr_wpset"