Skip to content

Instantly share code, notes, and snippets.

@dzogrim
Created July 26, 2026 15:02
Show Gist options
  • Select an option

  • Save dzogrim/d588580d5e027936015fad5d1dd6febc to your computer and use it in GitHub Desktop.

Select an option

Save dzogrim/d588580d5e027936015fad5d1dd6febc to your computer and use it in GitHub Desktop.
tiff2jpeg - published from local Scripts source of truth
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Script : tiff2jpeg
# Description :
# Converts every TIFF image in the current directory to JPEG using
# ImageMagick, then moves each successfully converted source file to
# the current user's Trash directory.
#
# Input files are processed from the current working directory and matched
# with the pattern "*.tiff". The generated JPEG keeps the original base name.
#
# Usage:
# tiff2jpeg
#
# Requirements:
# ImageMagick `convert` must be available in PATH.
#
# Warning:
# Source TIFF files are moved to "${HOME}/.Trash/" after conversion.
# Existing JPEG files with matching names may be overwritten.
# shellcheck disable=SC2034
readonly VERSION="0.1.0 (2019-11-04)"
[[ ! $( command -v convert ) ]] && echo "Please install ImageMagick first..." && exit 1
for i in *.tiff; do
convert "${i}" "${i%%.tif*}.jpg"
mv "${i}" "${HOME}/.Trash/"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment