Skip to content
Dmitry Kann edited this page Oct 4, 2019 · 1 revision

Can be used to prepare images for publishing on the web (or anywhere else). It supports image watermarking and direct upload into Google Photos (formerly 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. Image file is converted to WebP.
  6. The prepared picture file is placed into the upload directory.
  7. The prepared (temporary) file is deleted.

As the last step, after all files are successfully processed, gphotos-uploader-cli is run to upload the contents of the upload directory into Google Photos.

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

Synopsis

automark [options] pictures_dir

Where:

  • options Any combination of the following:
    • -B Do not add a black border to the image
    • -D Do not delete the photos after uploading (leave them in the source directory). If this option is used, processed picture files, having .w. in their names, will be created in the same directory where the source ones reside. Otherwise a temporary directory will be used.
    • -P Do not convert to WebP
    • -R Do not resize photos to the default size
    • -U Do not upload the photos to Google Photos (implies -D)
    • -W Do not watermark images
    • -b Use black watermark instead of the default white one
    • -d Delete original (after successful processing)
    • -s Use "small" watermark instead of the default one (better for smaller images)
  • pictures_dir Path to directory with pictures to process

Requires

  • ImageMagick:

    sudo apt-get install imagemagick
  • webp for WebP support:

    sudo apt-get install webp
  • gphotos-uploader-cli if you plan to use automatic uploading: download and unpack the binary from .tar.gz, then put it into /usr/local/bin/.

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
dir_upload="$HOME/tmp/gphoto-upload"                               # Path that gphotos-uploader-cli is configured to upload from

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) Google Photos. Images are automatically watermarked, resized and framed:
automark ~/Pictures/blog
  1. 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 .w. inserted before the extension and reside in the dir_upload directory specified above:
automark -U ~/Pictures
  1. The same as previous, but the images are only resized:
automark -UWB ~/Pictures

See also