Plugin is created as a part of an aura project.
Plugin takes a single argument - path of an image file - and then performs the following actions:
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/lqr_wpset.py").
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 = *3, *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'
Plugin code is released under a permissive WTFPL license, feel free to hack and reuse it as you see fit.