Yktools

A collection of utility scripts for Linux (including Ubuntu).

The following scripts are available:

generate-wallpaper-xml

Creates an XML wallpaper description file for GNOME or Ubuntu.

There is another script of similar functionality in this collection, rotate-wallpaper, which sets a random image file as desktop wallpaper. It has only one downside: you have to run it every time you want to rotate your wallpaper.

However GNOME since 2.28 allows assigning a slide show as wallpaper by providing an image list in XML format. There you can specify the order and duration for each image. Moreover, you can even define a transition from one image to another.

So I decided to create a simple script that generates an XML file for a given set of images and, optionally, sets that as the current wallpaper. It requires GNOME 3+ or Ubuntu (11.10 or later).

Synopsis

generate-wallpaper-xml [options] pictures_dir xml_file

Where:

Usage examples

  1. Create the file wallpapers.xml in the Pictures subdirectory (in the user's home directory) from picture files from the same subdirectory:

    generate-wallpaper-xml ~/Pictures ~/Pictures/wallpapers.xml

  2. The same as above, but additionally set the generated file as the current wallpaper:

    generate-wallpaper-xml -w ~/Pictures ~/Pictures/wallpapers.xml

  3. The same as previous, plus set display duration of each file to 10 minutes (600 seconds), and disable transitions between images:

    generate-wallpaper-xml -w -d 600 -t 0 ~/Pictures ~/Pictures/wallpapers.xml

  4. The same as previous, plus shuffle the file list so that they are ordered randomly:

    generate-wallpaper-xml -w -s shuffle -d 600 -t 0 ~/Pictures ~/Pictures/wallpapers.xml

See also

picasa-upload

Can be used to prepare images for publishing on the web (or anywhere else). It supports image watermarking and direct upload into Google+ (a.k.a. Google Photos, a.k.a. Google Picasa Web). If the image contains description in its metadata, it is propagated also to the uploaded picture.

By default every picture file is processed as follows:

  1. The image is autorotated according to its Image Orientation EXIF tag, if needed.
  2. If the image is bigger than 1600 pixels (the value is adjustable in the script header) by width or height, it is resized to fit this limit.
  3. A watermark is applied at the lower bottom corner of the image.
  4. A black frame is added outside of the image.
  5. The prepared picture file is uploaded to Google+/Picasa.
  6. The prepared (temporary) file is deleted.

Any of the above can be switched off by using options (see below).

Synopsis

picasa-upload [options] pictures_dir [album_name]

Where:

Requires

Configuration

Before first usage you have to review and update some variables defined at the top of the script:

pic_size=1600                                                      # Max size of the pictures to upload
file_watermark_white="$HOME/Pictures/Misc/dk-watermark-white.png"  # Default watermark file
file_watermark_black="$HOME/Pictures/Misc/dk-watermark-black.png"  # Black watermark file
file_watermark_small="$HOME/Pictures/Misc/dk-watermark-small.png"  # 'Small' watermark file
picasa_owner="dmitry.kann"                                         # Owner of the Google+/Picasa account

You will also be offered to login to Google at first run.

Usage examples

  1. Upload all the images from the Pictures/blog subdirectory (in the user's home directory) into the My blog Google+/Picasa album. Images are automatically watermarked, resized and framed:

    picasa-upload ~/Pictures/blog "My blog"

  2. Watermark, resize and frame all the images from the Pictures subdirectory (in the user's home directory), but don't upload them anywhere. Watermarked image files have the string .picasaweb inserted before the extension and reside in the same directory as the source image:

    picasa-upload -U ~/Pictures

  3. The same as previous, but the images are only resized:

    picasa-upload -UWB ~/Pictures

See also

rotate-wallpaper

Picks up a random image file (.jpg, .jpeg or .png) from the predefined directory and sets it as wallpaper. The script uses the dconf configuration backend and therefore requires GNOME 3 or Ubuntu (11.10 Oneiric Ocelot or later).

Synopsis

rotate-wallpaper

Configuration

Before you can use the script you have to edit it to modify the value of dir_wallpapers to point to the directory with image files.

See also

update-exif-date

Sometimes you know when a photo has been made, but the image file does not contain the date in its metadata. For instance, if you've scanned a printed photo.

This script updates the EXIF date of a JPEG image according to the file name, for all files in the specified directory. The file name must be in the following format: yyyy-mm-dd the-rest-does-not-matter.jpg.

Synopsis

update-exif-date pictures_dir

Where:

Requires

Usage examples

  1. Update the EXIF date for all the .jpg files in the Pictures subdirectory (in the user's home directory):
    update-exif-date ~/Pictures

See also

Source Code

To download the latest source code, clone my GitHub repository:

git clone https://github.com/yktoo/yktools.git

License

This software is distributed on the terms of GNU General Public License Version 3 or (optionally) any later version.

Software and any related documentation are provided on an as is basis, without warranty of any kind. The entire risk arising out of use or performance of the software remains with you.

The source code is available in my GitHub repository.