Selecting Pictures from a Directory with Large Number of Pictures – Utility Program

This program is a valuable tool for photographers dealing with a large volume of digital images. It simplifies the process of reviewing and selecting the best shots by allowing the user to seamlessly browse through a directory of images using feh, a versatile image viewer. The program provides essential functionality such as zooming, navigation between images, and most importantly, the ability to save the chosen images to a specified directory with a single key press. This streamlined workflow enhances efficiency and saves time, ensuring photographers can quickly identify and preserve their best work amidst a vast collection of photographs. I created this utility program for make a photographer’s life easier!

Utility Program for Selecting Photos from a Directory

!/bin/bash
Function to display the welcome message and wait for user input

display_welcome_message() {
echo “Welcome to the Image Viewer and Saver!”
echo “—————————————“
echo “This program allows you to browse images in a directory using feh.”
echo “In feh, you can use the following keys:”
echo ” – Right Arrow: Move forward to the next image”
echo ” – Left Arrow: Move backward to the previous image”
echo ” – ‘1’ Key: Save the current image”
echo “—————————————“
echo “Instructions:”
echo ” – To terminate the program, simply close the picture directory.”
echo ” – The program will automatically close when you do this.”
echo “—————————————“
echo “Press Enter to continue…”
read -r
}

Function to prompt the user for the directory to save the images

prompt_save_directory() {
save_directory=$(zenity –file-selection –directory –title=”Select a directory to save”)
if [ -z “$save_directory” ]; then
echo “Please select a directory to save the images before starting feh.”
exit 1
fi
}

Display the welcome message and wait for user input

display_welcome_message

Prompt the user to select a directory to open

open_directory=$(zenity –file-selection –directory –title=”Select a directory to open”)
if [ -n “$open_directory” ]; then
echo “You selected to open: $open_directory”
else
echo “No directory selected to open.”
exit 1
fi

Prompt the user for the directory to save the images

prompt_save_directory

Start feh to view images in the open directory

feh –scale-down –auto-zoom -Z –draw-filename \
–action1 “cp %F ‘$save_directory'” “$open_directory”

Published by kalyansg

Technical Author Interests - Use of Technology in Teaching & Learning

Leave a comment