Apply Multiple Hald-CLUT Presets in a Single Action with a Bash Shell Script

Moto G4. Processed in digiKam.

Hald-CLUT files offer a straightforward way to apply color corrections to an image (read the Linux Photography book to learn more about Hald-CLUT and its usage). Install ImageMagick on your system, and you can easily apply a Hald-CLUT preset to an image file using the following command:

convert foo.JPG hald-9.png -hald-clut foo-modified.jpeg

But what if you have a handful of Hald-CLUT files and you want to apply them all to a specific photo? A relatively simple Bash shell script can automate this otherwise tedious task:

#!/usr/bin/env bash
if [ -z "$1" ]; then
  echo "Specify the required parameter."
  exit 1
if [ ! -d "$dir" ]; then
  mkdir -p "$dir"
for file in *.png; do
  bname=$(basename "$1")
  echo "Applying $file Hald-CLUT ..."
  convert "$1" "$file" -hald-clut "$dir/$prefix-$bname"

The script picks .png Hald-CLUT files in the current working directory one-by-one and applies them to the specified image file. The modified files are saved in the separate hald-clut directory, and each file is prefixed with the name of the applied Hald-CLUT file.

Here is how this works in practice. First of all, paste the code above into a text file and save it under the hald-clut name. Use then the following commands to copy the created file to the /usr/local/bin directory and make the script executable:

sudo cp hald-clut /usr/local/bin/
sudo chown root:root /usr/local/bin/hald-clut
sudo chmod 755 /usr/local/bin/hald-clut

Now, let’s say you want to apply all Hald-CLUT presets in the hald-clut-files directory to the foo.JPG file. In the terminal, switch to the directory, and run the hald-clut path/to/foo.JPG command (replace path/to/foo.JPG with the actual path to the desired file). This apply all presets to the foo.JPG image and saves the resulting files in the hald-clut-files/hald-clut directory.

This is an excerpt from the Linux Photography book. Get your copy here.

Tagged with: , ,
Posted in Open Source, Photography, Scribbles, Software

[REPOST] The Weird and Wonderful Gas Stations of Iraq (Yes, Gas Stations)

The 70-mile stretch of dusty highway connecting Kirkuk to Sulaymaniyah in Northern Iraq looks like any other road in the world—except for the 70-plus gas stations lining the shoulder. Some look more like a temple. Or have gold-plated pillars. Or brandish a snappy set of Kurdish flags.

Continue reading The Weird and Wonderful Gas Stations of Iraq (Yes, Gas Stations)

Posted in Reposts

WD My Passport Wireless Linux Hacks


While WD My Passport Wireless is a rather useful device in its own right, the fact that it powered by a lightweight yet complete Linux distribution means that its capabilities can be extended even further. Deploy, for example, rclone on the device, and you can back up the photos and raw files stored on the disk to any supported cloud storage service.

Before you can do this, though, you need to connect the device to a Wi-Fi network and enable SSH (so that you can access the underlying Linux system via SSH). To connect the WD My Passport Wireless to you current Wi-Fi network, power the device and connect to the wireless hotspot it creates from your regular Linux machine. Open a browser, point it to http://mypassport.local, and log in to the device’s web interface. Switch to the Wi-Fi section, and connect to the existing your local Wi-Fi network. Switch then to the Admin section and enable SSH access.


On your Linux machine, open the terminal and connect to the device using the ssh root@mypassport.local command.

Deploying rclone then is a matter of running the following commands:

curl -O
cd rclone-*-linux-arm
cp rclone /usr/sbin/
chown root:root /usr/sbin/rclone
chmod 755 /usr/sbin/rclone
mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb

Once you’ve done that, run the rclone config command. Since you are configuring rclone on a headless machine, follow the instructions on the Remote Setup page. You’ll find detailed information on configuring and using rclone in the Linux Photography book.

You can put the WD My Passport Wireless to other practical uses, too. Since the device comes with Python, you can run scripts and Python-based web applications on the device. For example, you can deploy the simple What’s in My Bag application to track your photographic gear.

curl -LOk
mv wimb-master/ wimb
cd wimb
curl -LOk

Run ./ to start the app and point the browser to http://mypassport:8080/wimb to access and use the application.

Tagged with: , , , ,
Posted in Hardware, Open Source, Software

Sonnenhut: a Script to Run before a Photo Walk


Before you head for a photo walk, it makes sense to check the weather and ensure that you won’t miss the golden hour. And Sonnenhut can help you with that. This simple Python script fetches and displays current weather conditions and golden hour info for a specified city. The script is available on GitHub under the GPLv3 license.

Read more ›

Posted in Open Source, Photography, Software

[REPOST] Eiji Ohashi, Roadside Lights (Japan)

There is something rather charming about a quiet elderly gentleman wading through terrain, season and weather to photograph vending machines across Japan.

Continue reading Eiji Ohashi, Roadside Lights (Japan)

Posted in Scribbles

[REPOST] Remarkable Photos Capture the Light That Plants Emit

The plants in Craig Burrows’ photos look like something plucked from an alien planet, sprouting wild shades of violet, pink and green. But the plants, and the colors are real.

Continue reading Remarkable Photos Capture the Light That Plants Emit

Posted in Reposts

Show Geotagged Photos on OpenStreetMap


Want to show on the map the place where you took a specific photo? Provided that the photo is geotagged, the simple function below will do the job:

if [ -x "$(command -v exiftool)" ] ; then
function show-on-osm(){
lat=`exiftool -n -p '$GPSlatitude' $1`
lon=`exiftool -n -p '$GPSlongitude' $1`
xdg-open $osm

The function extracts latitude and longitude values from the photo’s EXIF metadata, creates an OpenStreetMap URL, and opens it in the default browser.

For the function to work, you need to install the ExifTool on your system. Add the function to the ~/.bashrc file, and use the show-on-osm foo.JPG command to show the photo you want on OpenStreetMap (replace foo.JPG with the actual name of the desired photo).

This is an excerpt from the Linux Photography book. Get your copy here.

Posted in Open Source, Photography, Software